xslt-1.0

muenchian grouping in the second level

心已入冬 提交于 2019-12-02 02:43:33
问题 This is my xml input <issues> <issue status="open" type="Bug"> <fix_versions> <fix_version>6.14.0</fix_version> <fix_version>6.13.0</fix_version> <fix_version>6.12.0</fix_version> </fix_versions> <title>issue1</title> <description>Description</description> </issue> <issue status="open" type="Feature"> <fix_versions> <fix_version>6.13.0</fix_version> </fix_versions> <title>issue2</title> <description>Description</description> </issue> <issue status="open" type="Improvement"> <fix_versions>

muenchian grouping in the second level

主宰稳场 提交于 2019-12-02 01:40:41
This is my xml input <issues> <issue status="open" type="Bug"> <fix_versions> <fix_version>6.14.0</fix_version> <fix_version>6.13.0</fix_version> <fix_version>6.12.0</fix_version> </fix_versions> <title>issue1</title> <description>Description</description> </issue> <issue status="open" type="Feature"> <fix_versions> <fix_version>6.13.0</fix_version> </fix_versions> <title>issue2</title> <description>Description</description> </issue> <issue status="open" type="Improvement"> <fix_versions> <fix_version>6.14.0</fix_version> </fix_versions> <title>issue3</title> <description>Description<

XPath/XSLT contains() for multiple strings

蓝咒 提交于 2019-12-02 01:24:57
Does contains() work for multiple words stored in a variable? Will the below one work? If it won't work, please help me with a solution. <xsl:variable name="games" select="footballvolleyballchesscarrom"/> <xsl:when test="contains($games,'chess,carrom')">CORRECT</xsl:when> I think multiple variables will not work with contains method. As per the defination: boolean contains(str1, str2) str1 : A string that might contain the second argument. str2: A string that might be contained in the first argument. Refer : https://msdn.microsoft.com/en-us/library/ms256195(v=vs.110).aspx You can use or

Aggregate-function for sum and product in XPath

Deadly 提交于 2019-12-02 01:14:36
问题 Similar to this question (http://stackoverflow.com/q/1333558/948404) I want to use XPath to calculate a sum over products in a structure like this: <items> <item> <value>1.0</value> <quantity>3</quantity> </item> <item> <value>2.5</value> <quantity>2</quantity> </item> <!-- ... --> </items> Is there an XPath expression that calculates the sum of the products of each items value and quantity ? Update: The solution has to work with PHPs XSLTProcessor class meaning that it probably has to be

xslt compare two different nodes and then combine

为君一笑 提交于 2019-12-01 23:12:01
I have a requirement where i need to show the difference amount ( <TotalAmount> ) based on two different values which is in different section.The input xml as below. <TXLife xmlns="http://ACORD.org/Standards/Life/2"> <TXLifeRequest> <FundCode>LTRW00</FundCode> <AccountNumber>34142</AccountNumber> <ReversalInd>Cr</ReversalInd> <TotalAmount>1600</TotalAmount> </TXLifeRequest> <TXLifeRequest> <FundCode>LTRW00</FundCode> <AccountNumber>34142</AccountNumber> <ReversalInd>Dr</ReversalInd> <TotalAmount>350</TotalAmount> </TXLifeRequest> <TXLifeRequest> <FundCode>LUL500</FundCode> <AccountNumber>34142

Transform to remove duplicate and copy rest

本小妞迷上赌 提交于 2019-12-01 21:21:41
I want the output xml to have grouped for the element 'c', according to the attribute 'f'. Here is my input xml and the xslt. I want the group to occur only once and the other nodes should be copied as is to the output. The xslt i tried, copies the entire input xml. So if there are two or more elements with c element and same attribute value for 'f', want the first occurence of that group to the output. My wanted result is also copied. input xml <M> <a> <b> <c f="123"> <d>Al</d> <e NO="678"> <f>Y</f> <g> <h>FTO</h> </g> </e> </c> </b> </a> <a> <b> <c f="123"> <d>Al</d> <e NO="678"> <f>Y</f> <g

Aggregate-function for sum and product in XPath

馋奶兔 提交于 2019-12-01 20:23:57
Similar to this question (http://stackoverflow.com/q/1333558/948404) I want to use XPath to calculate a sum over products in a structure like this: <items> <item> <value>1.0</value> <quantity>3</quantity> </item> <item> <value>2.5</value> <quantity>2</quantity> </item> <!-- ... --> </items> Is there an XPath expression that calculates the sum of the products of each items value and quantity ? Update: The solution has to work with PHPs XSLTProcessor class meaning that it probably has to be XSLT 1.0 compliant. This is why I did not yet accept the two probably correct answers using XSLT 2.0. I

Condition <xsl:output> in XSLT 1.0?

匆匆过客 提交于 2019-12-01 18:46:59
问题 I have an XSLT 1.0 (2.0 is not an option) stylesheet which produces XHTML. It can, depending on a parameter, produce a full XHTML validable document or just a <div>...</div> snippet, intended for inclusion in a Web page. My problem is to produce different XML declarations in these two cases. For the standalone page, I need: <xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/> And for the <div> one: <xsl:output omit

Passing a URL variable into xsl

戏子无情 提交于 2019-12-01 18:14:36
问题 Is it possible to pass a URL variable into xsl. EG. http:www.somedomain.com/index.aspx?myVar=test&myVar2=anotherTest I'd like to be able to use the values of myVar and myVar2 in the logic of my xsl file. Thanks. 回答1: Sure, you can. Use xsl:param element in xsl:stylesheet element and pass parameter from your XSL engine. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="url"/> Then use string-functions, e.g.: <xsl:variable name="right-part" select=

Calculating day of the week XSL

六月ゝ 毕业季﹏ 提交于 2019-12-01 14:34:32
Trying to calculate day of the week number from date. Found some examples in the internet, but instead of day of the week number i see this : NaN. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:strip-space elements="*"/> <xsl:output indent="yes"/> <xsl:template match="node()"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="date"> <xsl:copy> <xsl:call-template name="date-format"> <xsl:with-param name="date-time" select="."/> </xsl:call-template> </xsl:copy> </xsl:template> <xsl