xslt-2.0

how to get the most deeply nested element nodes using xpath? (implementation with XMLTWIG)

邮差的信 提交于 2019-11-28 01:20:03
问题 I need to extract (XSLT, xpath, xquery... Preferably xpath) the most deeply nested element nodes with method (DEST id="RUSSIA" method="delete"/>) and his direct ancestor (SOURCE id="AFRICA" method="modify">). I don't want to get the top nodes with methods ( main method="modify"> or main method="modify"> ). The deepest nested elements with method correspond to real actions. The top elements with method actually are dummy actions that must not be taken into account. Here is my XML sample file:

What is the default select of XSLT apply-templates?

对着背影说爱祢 提交于 2019-11-27 23:47:13
问题 The identity template looks like this: <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> Does <xsl:apply-templates select="@*|node()" /> select more than <xsl:apply-templates /> , or could the identity template have been like this? <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates /> </xsl:copy> </xsl:template> What exactly is selected when I do the following? <xsl:apply-templates /> 回答1: Does <xsl:apply-templates

How to use for each group in XSL

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 23:01:12
im still learning for-each-group what is the best way of grouping something like this using XSL?(by country) i'm trying to use XSL to convert this XML to another XML. <?xml version="1.0" encoding="UTF-8"?> <Person> <Student> <Info Country="England" Name="Dan" Age="20" Class="C" /> </Student> <Student> <Info Country="England" Name="Dan" Age="20" Class="B" /> </Student> <Student> <Info Country="England" Name="Sam" Age="20" Class="A" /> </Student> <Student> <Info Country="Australia" Name="David" Age="22" Class="D" /> </Student> <Student> <Info Country="Australia" Name="David" Age="22" Class="A" /

Use saxon with python

孤街浪徒 提交于 2019-11-27 22:35:45
I need to process XSLT using python, currently I'm using lxml which only support XSLT 1, now I need to process XSLT 2 is there any way to use saxon XSLT processor with python? There are two possible approaches: set up an HTTP service that accepts tranformation requests and implements them by invoking Saxon from Java; you can then send the transformation requests from Python over HTTP use the Saxon/C product , currently available on prerelease : details here: http://www.saxonica.com/saxon-c/index.xml A Python interface for Saxon/C is in development and worth a look: https://github.com/ajelenak

Java XSLT processors supporting XPath 2.0

拟墨画扇 提交于 2019-11-27 20:05:01
问题 What are the currently available XSLT processors supporting XPath 2.0 standard? 回答1: XSLT 2.0 Processors There are several XSLT 2.0 processors for various languages. Java Written for Java, or reported to have a Java interface: Saxon 9.x by Michael Kay WebSphere 7 XML Feature Pack by IBM AltovaXML2009.exe by Altova .NET Written for the .NET framework: XQSharp 2.0 by Clinical & Biomedical Computing Ltd. Eiffel Written in Eiffel: Gestalt by Colin-Paul Adams Other SOA Expressway by Intel 回答2:

How can I calculate the absolute value of a number in XSLT?

為{幸葍}努か 提交于 2019-11-27 17:43:18
问题 I have <xsl:value-of select="DifferenceInDays" /> DifferenceInDays can be negative or positive, I want to display it as positive. How can I do this? 回答1: In XPath 1.0 use the following expression : $vNum*($vNum >=0) - $vNum*($vNum < 0) In case this expression is embedded in an XSLT (XML) attribute, the < character must be escaped: $vNum*($vNum >=0) - $vNum*($vNum < 0) In XPath 2.0 (XSLT 2.0) use the abs() function . 回答2: This can be achieved using the xpath abs function. <xsl:value-of select=

Read a remote zipped xml with just XSL

放肆的年华 提交于 2019-11-27 17:14:55
问题 I want to know if it's possible for an XSLT file to read data from an XML located within folders of a remote zip(from the server at work), without any external processors (saxon and so forth) and without downloading it. Failing that, I'll resort to just reading the information from the zip... which brings me to my other (newb)issue. I currently have an XSLT that accesses and gets the data from the downloaded and extracted XML file, but I can't do this without extracting it. I've read that

Remove Elements and/or Attributes by Name per XSL Parameters

☆樱花仙子☆ 提交于 2019-11-27 16:06:18
问题 The following does the job of removing unwanted elements and attributes by name ("removeMe" in this example) from an XML file: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:template match="node() | @*" name="identity"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> <xsl:template match="removeMe"/> </xsl:stylesheet> The problems are it does not distinguish between

Upgrade PHP XSLT processor to XSLT 2.0

爱⌒轻易说出口 提交于 2019-11-27 16:03:25
问题 Is it possible/easy to upgrade PHP's library to use XSLT 2.0? Current set up: xsl XSL enabled libxslt Version 1.1.24 libxslt compiled against libxml Version 2.6.32 EXSLT enabled libexslt Version 1.1.24 回答1: The Saxon-C project provides a PHP API for its XSLT 2.0 implementation. Here is the basic installation process: Please have the following packages on your machine to build the Saxon/C PHP extension: make, php-devel, (php5-dev/php55-dev/php55w-devel), apache2 or httpd, gcc-c++ or g++, gcj

adding attribute to the node

青春壹個敷衍的年華 提交于 2019-11-27 12:31:07
I am trying to add an attribute to the node if the child node value is equal to some string. I have a main.xml file <Employees> <Employee> <countryid>32</countryid> <id name="id">1</id> <firstname >ABC</firstname> <lastname >XYZ</lastname> </Employee> <Employee> <countryid>100</countryid> <id name="id">2</id> <firstname >ddd</firstname> <lastname >ggg</lastname> </Employee> </Employees> So let's say if the country id is equal to 32 then it should add attribute country=32 to Employee node. The output should be like below : output.xml <Employees> <Employee countryid="32"> <countryid>32<