xslt-1.0

Select all of an element between the current element and the next of the current element

天涯浪子 提交于 2019-12-11 11:11:29
问题 Using XSLT 1.0 (preferably), How can I select all of an element which occurs between the current element and the next time the current element occurs? Say I have this XML (edited): <root> <heading_1>Section 1</heading_1> <para>...</para> <list_1>...</list_1> <heading_2>Section 1.1</heading_2> <para>...</para> <heading_3>Section 1.1.1</heading_3> <para>...</para> <list_1>...</list_1> <heading_2>Section 1.2</heading_2> <para>...</para> <footnote>...</footnote> <heading_1>Section 2</heading_1>

Using external XML uri with variables

感情迁移 提交于 2019-12-11 11:08:12
问题 I searched here and on the big G, I am willing to learn, but I didn't found the answer yet. I am trying to transform external XML data with XSLT to be easily read in HTML or PHP. I tested a few things and I successfully transformed some simple XML files with XSL and PHP. The problem is that the actual XML files I need to use are not really the typical dot xml files we generally see, but more like the format "http://webservices.nextbus.com/service/publicXMLFeed?command=vehicleLocations&a=sf

XSLT decimal-format causes exception

一曲冷凌霜 提交于 2019-12-11 10:42:57
问题 I am trying to use the xslt:decimal-format element, but I get the same error message whether I use my own code or the example code provided by w3schools.com. This is the w3 sample code: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:decimal-format name="euro" decimal-separator="," grouping-separator="."/> <xsl:template match="/"> <xsl:value-of select="format-number(26825.8, '#,###.00', 'euro')"/> </xsl:template> </xsl:stylesheet> And this is the

How to get value of unique XML element by using XSLT

放肆的年华 提交于 2019-12-11 10:37:20
问题 I want the unique list of elements from XML document. If the occurrence of element is more than 1, i want to have the last occurrence in my output: Please refer the below XML for getting unique list: <Organization> <Fund> <id>001</id> <name>ABC Ltd</name> </Fund> <Fund> <id>002</id> <name>DEF Limited</name> </Fund> <Fund> <id>001</id> <name>ABC Ltd.</name> </Fund> <Fund> <id>002</id> <name>DEF Corporation</name> </Fund> <Fund> <id>003</id> <name>XYZ LLC.</name> </Fund> </Organization> The

XML Key/value manipulation on condition using XSLT

那年仲夏 提交于 2019-12-11 10:13:58
问题 I have data like this - <item> <name>Bob</name> <fav_food>pizza</fav_food> <key>Salary</key> <value /> <value2>1000</value2> <value3 /> </item> I want my output to look like this - <item> <name>Bob</name> <fav_food>pizza</fav_food> <Salary>1000</Salary> </item> In this case, Salary gets the value of 1000 because value is empty and value2 is not (value has higher priority than value2, which has higher priority than value3). It is guaranteed that value,value2 and value3 all exist, and only one

condition checking in xslt

删除回忆录丶 提交于 2019-12-11 09:38:48
问题 A Little update in my previous question already @Dimetre answered that Link Input XML <tutorial> <lessons> <lesson> chapter Bat 20 </lesson> <lesson> chapter Pen Ball 10~ </lesson> <lesson> chapter Book </lesson> <lesson> note lesson </lesson> <lessons1> <lesson> chapter Pencil 10 </lesson> <lesson> description page </lesson> <lesson> chapter Car Tank 25 </lesson> </lessons1> </lessons> The Output will be <Geography> <historical> <social> <toc1> <toc> <chapter>chapter</chapter> <unit>Bat<

XSLT 1.0 sort on filtered XML data

寵の児 提交于 2019-12-11 09:38:34
问题 Ok so based on this question XSLT 1.0 sort elements I cannot figure out why the following is not working: I have the following XML: <?xml version="1.0" encoding="UTF-8"?> <viewentries> <viewentry> <entrydata name="Waste"> <text>Bric-a-Brac</text> </entrydata> <entrydata name="Disposal"> <text/> </entrydata> </viewentry> <viewentry> <entrydata name="Waste"> <textlist> <text>Paper</text> <text>Glass</text> </textlist> </entrydata> <entrydata name="Disposal"> <text/> </entrydata> </viewentry>

XSLT select only last version element in rowset

£可爱£侵袭症+ 提交于 2019-12-11 09:18:35
问题 My xml is: <RowSet> <Row> <msg_id>1</msg_id> <doc_id>1</doc_id> <doc_version>1</doc_version> </Row> <Row> <msg_id>2</msg_id> <doc_id>1</doc_id> <doc_version>2</doc_version> </Row> <Row> <msg_id>3</msg_id> <doc_id>1</doc_id> <doc_version>3</doc_version> </Row> <Row> <msg_id>4</msg_id> <doc_id>2</doc_id> <doc_version>1</doc_version> </Row> <RowSet> What I need to do: If there are Rows with the same doc_id , I need to select only node with the bigger doc_version number. Expected output: <RowSet>

opposite method to disable output escaping in xslt [duplicate]

会有一股神秘感。 提交于 2019-12-11 09:13:10
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: XSLT: How to convert XML Node to String Input: <text> aabbabab </text> output: <text> aabbabab </text> This is the opposite to Disable output escaping. How can we achieve this in xslt. Can some one help on this. Thanks 回答1: See this answer . In summary, the shortest solution uses a tiny extension function. 回答2: If you can use Saxon extensions, try <xsl:value-of select="saxon:serialize(text)"/> If not, there are

Get value from web.config into XSLT file

我与影子孤独终老i 提交于 2019-12-11 08:59:03
问题 I have some values in my web.config that I want to access in my XSLT file. How do I do that? I have done this to load the config file in my XSLT: <xsl:variable name="config" select="document('..//Website//web.config')"/> <p><xsl:value-of select="$config//appSettings/add[@key='Test']/@value"/> </p> After this I am stuck - nothing gets rendered. Ok.I have done some changes.I have tried using a separate XML file and i am able to get value from the file in my variable. <xsl:apply-templates select