xslt-2.0

How to insert a constructed XML nodes in XQuery?

梦想与她 提交于 2019-12-11 14:17:58
问题 I want to insert a node using below code but if i will rerun the code i don't want my node to be repeated twice- let $doc := fn:doc("abc.xml") (: abc.xml looks like-- <root> <value1>somevalue</value1> <value2>somevalue</value2> <value3>somevalue</value3> <value4>somevalue</value4> <value5>Australia</value5> <value6>India</value6> <value7>USA</value7> <value8>somevalue</value8> <value9>somevalue</value9> <value10>somevalue</value10> </root> :) let $element := element Root{ element A{"A"},

Merging tags based on two different complex tags

谁说我不能喝 提交于 2019-12-11 14:11:28
问题 In the below two ASNInPO's po_nbr is same container_id under ASNInCtn is same and item_id under ASNInItem is different. In this case two ASNInPO's has to be merged and two ASNInCtn's has to be merged into one tag. This is my Input: <?xml version = '1.0' encoding = 'UTF-8'?> <ASNInDesc> <asn_nbr>ASN-1</asn_nbr> <ASNInPO> <po_nbr>PO-2</po_nbr> <ASNInCtn> <container_id>CONTAINER-2</container_id> <ASNInItem> <item_id>ITEM-2</item_id> <unit_qty>3</unit_qty> </ASNInItem> </ASNInCtn> </ASNInPO>

Permutation in XSLT

删除回忆录丶 提交于 2019-12-11 13:40:30
问题 I'm sure the answer is going to be some sort of 'recursion' I'm struggling to get quite there though -- for a set of nodes, I want to return all their permutations: Input: <animals> <animal>Rabbit</animal> <animal>Turtle</animal> <animal>Moose</animal> </animals> Desired output: MooseRabbitTurtle MooseTurtleRabbit RabbitMooseTurtle RabbitTurtleMoose TurtleMooseRabbit TurtleRabbitMoose Note the alphabetical sorting, but if that's not possible, I can live without it. Also, there won't always be

How do I fix this XSLT that stopped working?

与世无争的帅哥 提交于 2019-12-11 13:06:21
问题 I have this XSLT that Marting Honnen graciously supplied (link) The template stopped working for some reason and I can't seem to fix it. The data expanded but I don't see how that should matter. Instead of turning the double pipe delimited text into xml; it just deletes the delimited data Here's the template and sample data: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply

Convert negative decimal to hexadecimal in xslt

折月煮酒 提交于 2019-12-11 12:40:58
问题 Please, can you help me how to convert negative/positive decimal value to hexadecimal in xslt/xslt 2.0 ? This is what i tried but does not work with negative numbers/decimals, <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template name="ConvertDecToHex"> <xsl:param name="index" /> <xsl:if test="$index > 0"> <xsl:call-template name="ConvertDecToHex"> <xsl:with-param name="index" select="floor($index div 16)" /> </xsl:call-template> <xsl:choose> <xsl:when

Copying a node from a custom function

馋奶兔 提交于 2019-12-11 12:25:54
问题 I need to remove duplicate values from the following xslt. Two nodes should be equal if only all their attributes are equal. The solution I've come up with is to look for the first occurrence of a component name(0 preceding siblings). If there are no following siblings then directly the copy the node. If there are following siblings then get all the nodes including the current node in to a variable. Process the variable with the code below to find unique occurences and copy the node when

Why does Saxon evaluate the result-document URI to be the same?

岁酱吖の 提交于 2019-12-11 12:08:43
问题 My XSL source document looks like this <Topology> <Environment> <Id>test</Id> <Machines> <Machine> <Id>machine1</Id> <modules> <module>m1</module> <module>m2</module> </modules> </Machine> </Machines> </Environment> <Environment> <Id>production</Id> <Machines> <Machine> <Id>machine1</Id> <modules> <module>m1</module> <module>m2</module> </modules> </Machine> <Machine> <Id>machine2</Id> <modules> <module>m3</module> <module>m4</module> </modules> </Machine> </Machines> </Environment> <

XSL-FO Grouping title with Section

本秂侑毒 提交于 2019-12-11 11:49:26
问题 Hello I want to transform my xml to grouping my titles here is my xml file: <?xml version="1.0" encoding="UTF-8"?> <root> <header1> <title>Head 1</title> <sub> <title>sub 1</title> </sub> <sub> <title>sub 2</title> </sub> </header1> </root> here is my xslt file: <xsl:template match="header1"> <fo:block> <xsl:number level="multiple" count="header" format="1"/> <xsl:value-of select="./title/text()"/> <xsl:apply-templates/> </fo:block> </xsl:template> <xsl:template match="sub"> <fo:block> <xsl

How to encode data of XSLT stylesheet

久未见 提交于 2019-12-11 10:57:29
问题 I have generated an XSLT stylesheet which converts an XML file to an ePub . I use saxon9.jar to convert the XML using XSLT . Now I need to know whether I can make the XSLT code binary. Is it possible using java , so that I can generate a jar file which converts the XML to ePub using saxon , provided that the content of XSLT file is not readable. 回答1: The problem got resolved after I read this page: http://saxon.sourceforge.net/saxon7.6/using-xsl.html#Compiling 回答2: One possibility would be to

Deleting parent nodes in XML using XSLT

99封情书 提交于 2019-12-11 10:47:30
问题 I need help in removing parent nodes from below given XML using XSLT.. <?xml version="1.0" encoding="UTF-8"?> <Report xmlns="OpenProblems2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="OpenProblems2" Name="OpenProblems2"> <Hello> <NewDataSet> <Table> <a>1832874</a> <b>HUME-9063</b> <c>not informed</c> </Table> <Table> <a>1832874</a> <b>HUME-9063</b> <c>not informed</c> </Table> </NewDataSet> </Hello> </Report> Output should look like - <NewDataSet> <Table> <a