xslt-2.0

how to parse the xml inside CDATA of another xml using xslt?

橙三吉。 提交于 2019-11-29 07:10:52
I need to transform the XML inside the CDATA of the XML using the single XSLT. I have an XML as below with xml inside the CDATA as in the below xml. <message channel-id="e01db0aa-b3db-4b6c-a055-7a0d5c1d1f20" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > <send-parameters> <agent-parameter multi-valued="false"> <name>Networks</name> <value><![CDATA[<Networks> <Network> <GroupCode>EXTPRI</GroupCode> <NetworkTypeId>LANI</NetworkTypeId> <OrgNetworkPlatformName>EON-0cbu0cust12301dcd-D-PCL-0002</OrgNetworkPlatformName> <OrgNetworkPlatformID>urn:vcloud:network:b7ccfd5f-cfd7-48eb-9dd6

XSLT: Finding last occurence in a string

送分小仙女□ 提交于 2019-11-29 06:56:52
Given a form number like: ABC_12345_Q-10 I want to end up with: ABC12345 So I need to find the position of the second underscore Note that there is no standard pattern or length to any of the "sections" between the underscores (so I cannot use substring to simply eliminate the last section). xPath 2.0 solutions are okay. concat( substring-before($s, '_'), substring-before(substring-after($s, '_'), '_') ) Alternatively: string-join(tokenize($s, '_')[position() <= 2], '') @Pavel_Minaev has provided XPath 1.0 amd XPath 2.0 solutions that work if it is known in advance that the number of

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

放肆的年华 提交于 2019-11-29 03:42:38
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? 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 . This can be achieved using the xpath abs function. <xsl:value-of select="abs(DifferenceInDays)"/> diffInDays * (1 - 2*(diffInDays < 0)) Some of the answers are complicating life way too

How to group and sum values in XSLT

≡放荡痞女 提交于 2019-11-29 03:34:38
For each "agency" node I need to find the "stmt" elements that have the same key1, key2, key3 values and output just one "stmt" node with the "comm" and "prem" values summed together. For any "stmt" elements within that "agency" that don't match any other "stmt" elements based on key1, key2 and key3 I need to output them as is. So after transformation the first "agency" node would only have two "stmt" nodes (one summed) and the second "agency" node would be passed as is because the keys don't match. XSLT 1.0 or 2.0 solutions are ok...though my stylesheet is currently 1.0. Note that the agency

How to convert ticks into a readable datetime with XSLT?

戏子无情 提交于 2019-11-29 03:34:30
I have an XML with timestamps like this: <node stamp="1236888746689" /> And I would like to display them in the result HTML as date with time. Is there a way to do it with XSLT (any Version)? EDIT: I am using XSLT2.0 with Saxon9. The base date is 1970-01-01 0:00. f3lix You take the date 1970-01-01T00:00:00 and add as many milliseconds as the value of the stamp tells you: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/TR/xhtml1/strict"> <xsl:template match="node"> <xsl:value-of select='xs

Read a remote zipped xml with just XSL

时光总嘲笑我的痴心妄想 提交于 2019-11-29 02:41:49
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 with Altova and xslt 2.0 it is possible to read from within a zip file using the document() function,

Upgrade PHP XSLT processor to XSLT 2.0

霸气de小男生 提交于 2019-11-29 01:31:45
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 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 (or just link the jni.h file) Run the commands: phpize ./configure --enable-saxon make sudo make install

How to select saxon TransformerFactory in Java

99封情书 提交于 2019-11-28 17:35:30
问题 In my web application I need to use Saxon TransformerFactory in order to use XSLT 2.0 but I can't use setProperty method because I don't have this right on the web server and there is a Security Manager. So I have read that it should be possible to do this: Use the Services API (as detailed in the JAR specification), if available, to determine the classname. The Services API will look for a classname in the file META-INF/services/javax.xml.transform.TransformerFactory in jars available to the

Java XSLT processors supporting XPath 2.0

流过昼夜 提交于 2019-11-28 17:16:18
What are the currently available XSLT processors supporting XPath 2.0 standard? Dimitre Novatchev 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 Oracle's XDK claims to support XSL and XPath 2.0. The IBM WebSphere Application Server Feature

How to create a boolean value?

南楼画角 提交于 2019-11-28 16:56:06
I am totally new to XSLT and can't work out where I am going wrong with the following code. <xsl:variable name="var" select="boolean('false')"/> <xsl:if test="$var'">variable is true</xsl:if> It is always returning true when it is meant to be false. Why? The value of the $var variable as defined in: <xsl:variable name="var" select="boolean('false')"/> is true() This is because in XPath " false " is an ordinary string, as opposed to false() , which is the constructor for the boolean value false() The two boolean values in XPath are (note that they are constructed!): true() and false() The