xslt

How to select the smallest value from a bunch of variables?

|▌冷眼眸甩不掉的悲伤 提交于 2020-02-03 05:20:07
问题 Assume I have variables $a , $b , $c and $d which all hold numbers. I would like to get the smallest (largest) value. My typical XSLT 1.0 approach to this is <xsl:variable name="minimum"> <xsl:for-each select="$a | $b | $c | $d"> <xsl:sort select="." data-type="number" order="ascending" /> <xsl:if test="position()=1"><xsl:value-of select="." /></xsl:if> </xsl:for-each> </xsl:variable> However, my xslt 1.0 processor complains with runtime error: file stylesheet.xslt line 106 element for-each

I have problems with right test variable with mark attribute

爱⌒轻易说出口 提交于 2020-02-02 14:33:20
问题 Hello I want to test variable, if its possible, I want it with attribute. So I have a XML: <tr class="alt-row"> <td class="column-country">American Samoa <span class="type">(Mobile)</span></td> <td class="column-rate">0.500</td> <td class="column-vat">0.575</td> </tr> <tr class=""> <td class="column-country">Andorra <span class="type">(Landline)</span> <span class="free">FREE*</span> <span class="superdeal">SuperDeal!**</span></td> <td class="column-rate">FREE*</td> <td class="column-vat"

need to transform an xml file into another xml using xslt whose xsl file uses a Properties.xml file

六月ゝ 毕业季﹏ 提交于 2020-02-02 13:05:29
问题 Consider my input xml file as below <?xml version="1.0" encoding="UTF-8"?> <com xsi:schemaLocation="http://do.way.com/sales/Amb http://do.way.com/temp/sales/ale/ax.xsd" xmlns:w="http://do.way.com/sales/W" xmlns="http://do.way.com/sales/Amb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wire="http://do.way.com/sales/Wire"> <content> <wire:wire> <wire:sI> <w:aH> <text>Ccc <dynamic name="C_R_N"/>: More</text> <w:contact value="false"/> </w:aH> <w:page> <nL>Please call us</nL> </w

need to transform an xml file into another xml using xslt whose xsl file uses a Properties.xml file

若如初见. 提交于 2020-02-02 13:04:03
问题 Consider my input xml file as below <?xml version="1.0" encoding="UTF-8"?> <com xsi:schemaLocation="http://do.way.com/sales/Amb http://do.way.com/temp/sales/ale/ax.xsd" xmlns:w="http://do.way.com/sales/W" xmlns="http://do.way.com/sales/Amb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wire="http://do.way.com/sales/Wire"> <content> <wire:wire> <wire:sI> <w:aH> <text>Ccc <dynamic name="C_R_N"/>: More</text> <w:contact value="false"/> </w:aH> <w:page> <nL>Please call us</nL> </w

need to transform an xml file into another xml using xslt whose xsl file uses a Properties.xml file

五迷三道 提交于 2020-02-02 13:03:26
问题 Consider my input xml file as below <?xml version="1.0" encoding="UTF-8"?> <com xsi:schemaLocation="http://do.way.com/sales/Amb http://do.way.com/temp/sales/ale/ax.xsd" xmlns:w="http://do.way.com/sales/W" xmlns="http://do.way.com/sales/Amb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wire="http://do.way.com/sales/Wire"> <content> <wire:wire> <wire:sI> <w:aH> <text>Ccc <dynamic name="C_R_N"/>: More</text> <w:contact value="false"/> </w:aH> <w:page> <nL>Please call us</nL> </w

JAXP Transformer via DOMSource returns stylesheet

时间秒杀一切 提交于 2020-02-02 11:37:51
问题 I'm having a strange problem and can't seem to find any solution. I'm simply trying to apply an XSLT stylesheet to an XML file (in this case, SPARQL query results formatted as XML, but any other XML file gives the same result). In this case, I need to create the transformer by re-using an already loaded XML document, via DOMSource. You can find the code below (simplified; normally, the stylesheet document comes from elsewhere): TransformerFactory factory = TransformerFactory.newInstance();

JAXP Transformer via DOMSource returns stylesheet

邮差的信 提交于 2020-02-02 11:36:05
问题 I'm having a strange problem and can't seem to find any solution. I'm simply trying to apply an XSLT stylesheet to an XML file (in this case, SPARQL query results formatted as XML, but any other XML file gives the same result). In this case, I need to create the transformer by re-using an already loaded XML document, via DOMSource. You can find the code below (simplified; normally, the stylesheet document comes from elsewhere): TransformerFactory factory = TransformerFactory.newInstance();

How can I match the xmlns:* attributes with XSLT?

一个人想着一个人 提交于 2020-02-02 07:26:04
问题 How can I match the xmlns:* attributes with XSLT 1.0 ? Using a RDF document I tried: <xs:template match="rdf:RDF"> (...) <xsl:for-each select="@*"> <xsl:value-of select="."/> </xsl:for-each> (...) </xsl:template> but it doesn't seem to work for the xmlns attributes. Thanks. 回答1: The xmlns attributes aren't normal attributes, they are namespace declarations. You need to use the namespace axis to access them. e.g.: <xsl:for-each select="namespace::*"> <xsl:value-of select="name()" /> </xsl:for

xslt 1.0 how to replace empty or blank value with 0 (zero) in select condition

孤街浪徒 提交于 2020-02-02 04:16:01
问题 <xsl:call-template name="SetNetTemplate"> <xsl:with-param name="xyz" select="$node1value + $node2value + $node3value - $node4value - $node5value - $node6value"/> </xsl:call-template> If nodevalue is empty or blank, i want to replace that value with 0 (zero). Problem is that in this calculation if any nodevalue is empty or blank, it is giving NaN result. e.g. select "10-2+5-2- -4" 回答1: Try it this way: <xsl:with-param name="xyz" select="translate(number($node1value), 'aN', '0') + translate

xslt 1.0 how to replace empty or blank value with 0 (zero) in select condition

独自空忆成欢 提交于 2020-02-02 04:14:10
问题 <xsl:call-template name="SetNetTemplate"> <xsl:with-param name="xyz" select="$node1value + $node2value + $node3value - $node4value - $node5value - $node6value"/> </xsl:call-template> If nodevalue is empty or blank, i want to replace that value with 0 (zero). Problem is that in this calculation if any nodevalue is empty or blank, it is giving NaN result. e.g. select "10-2+5-2- -4" 回答1: Try it this way: <xsl:with-param name="xyz" select="translate(number($node1value), 'aN', '0') + translate