xslt-1.0

XSLT 1.0 Using position() in <xsl:for-each> and <xsl:template>

六月ゝ 毕业季﹏ 提交于 2019-12-13 20:58:35
问题 My understanding is that the usage of <xsl:template /> and <xsl:for-each> almost serve the same purpose and <xsl:for-each > is a sort of "anonymous inline template" . Question: However, considering the below scenario, i think using <xsl:for-each> is more appropriate. Please validate my understanding, or is there a way the output can be achieved through <xsl:template> as well? Input XML: <?xml version="1.0" encoding="UTF-8"?> <books> <book.child.1> <title>charithram</title> <author>sarika<

How to improve my Muenchian grouping XSLT?

让人想犯罪 __ 提交于 2019-12-13 20:05:38
问题 Thanks to the help of Niraj and hr_117 I was able to arrive at an XSL template that turns this XML... <bookings> <entry> <event>Christmas</event> <attendees>2</attendees> </entry> <entry> <event>Halloween</event> <attendees>2</attendees> </entry> <entry> <event>Easter</event> <attendees>1</attendees> </entry> <entry> <event>Easter</event> <attendees>1</attendees> </entry> </bookings> ...into this output: Christmas: 1 booking(s) Halloween: 1 booking(s) Easter: 2 booking(s) This is my XSL: <xsl

Copy all xml elements excluding matched element root name using xslt

你离开我真会死。 提交于 2019-12-13 19:24:27
问题 Input XML: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns2:VendorMessageRequest xmlns:ns2="http://order.com.company.com"> <ns2:purchaseOrder> <assignedTo> <firstName>firstnm</firstName> <lastName>lstnm</lastName> </assignedTo> </ns2:purchaseOrder> </ns2:VendorMessageRequest> using XSLT as: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns2="http://www.company.com/services/entity/v1" xmlns:ns3="http://www.company.com/services/dataobject/v1"

checking condition xslt

感情迁移 提交于 2019-12-13 19:13:00
问题 With the previous post. here is the link Previous Question Again Small Update in input xml the other validation are all same. Here only the chapter (element) is changing instead of chapter i will have numbers <tutorial> <lessons> <lesson> 12000 Bat 20 </lesson> <lesson> 15000 Pen Ball 10~ </lesson> <lesson> 14000 Book </lesson> <lesson> note lesson </lesson> </lessons> <lessons1> <lesson> 24000 Pencil 10 </lesson> <lesson> description page </lesson> <lesson> 8000 Car Tank 25 </lesson> <

Use XSL to Iterate over Elements in For Each Loop

穿精又带淫゛_ 提交于 2019-12-13 18:04:23
问题 so I have been having serious issues getting this to work (and I'm sure it is simple, I have little experience with XSL). I am trying to iterate over a bunch of very different child elements in an xml document that is structured like this: <transaction> <data_xml> <document data_type="0"> <element1>value1</element1> <element2>value2</element2> <element3>value3</element3> </document> </data_xml> </transaction> I am using XSL version 1.0, and I'm pretty sure that I cannot use 2.0 for this

How to use XML wrapped in CDATA inside another XML for XSL transformation?

こ雲淡風輕ζ 提交于 2019-12-13 14:50:39
问题 An XML document contains another XML element, which is wrapped in CDATA. How can the wrapped XML be used for XSL and XSL-FO transformation (version 1)? 回答1: This is not possible with standard XSLT 1.0 or 2.0, in a single transformation. It can be done using Saxon 9 Professional Edition or Enterprise Edition. These products have a saxon:parse() extension function. Or use the XPath 3.0 parse-xml() function, which is also supported by recent versions of Saxon PE/EE. As @grtjn points out, it is

XSLT nested sort / for-each

懵懂的女人 提交于 2019-12-13 14:12:29
问题 I am trying to figure out the best way to perform a nested for-each & sort. For example my XSLT below performs the following: Selects a node set. Sorts by Date attribute. Performs position() to pull 4 nodes. Now, the next part is what I am trying to figure out. After step 3 I need to sort by the Date attribute again, but this time in asceding order...now that the data set is narrowed down to 4 nodes. Suggestions? Thanks for the help!! XSLT: <xsl:template name="AdmissionsNewsList"> <ul class=

When test hanging in an infinite loop

时光总嘲笑我的痴心妄想 提交于 2019-12-13 12:32:28
问题 I'm tokenising a string with XSLT 1.0 and trying to prevent empty strings from being recognised as tokens. Here's the entire function, based on XSLT Cookbook: <xsl:template name="tokenize"> <xsl:param name="string" select="''" /> <xsl:param name="delimiters" select="';#'" /> <xsl:param name="tokensplitter" select="','" /> <xsl:choose> <!-- Nothing to do if empty string --> <xsl:when test="not($string)" /> <!-- No delimiters signals character level tokenization --> <xsl:when test="not(

Unbounded XML Element to name/value pairs without repeating Element names in XSLT

岁酱吖の 提交于 2019-12-13 10:57:25
问题 I have written an xslt to convert an input xml file to name/value pairs. The input xml is as follows: INPUT.xml <?xml version="1.0" encoding="UTF-8" ?> <EMailData> <PersonInfo> <PersonID>PersonID1092</PersonID> <EmailAddress>EmailAddress1093</EmailAddress> <SecureToken>SecureToken1094</SecureToken> <ContactPrimaryChannel>ContactPrimaryChannel1172</ContactPrimaryChannel> <Order> <OrderID>OrderID1224</OrderID> <CustomerOrderNumber>CustomerOrderNumber1225</CustomerOrderNumber> <OrderType/>

Replace xml attribute values with constant values by xsl

元气小坏坏 提交于 2019-12-13 10:40:23
问题 there is that XML Node <svg> <g transform="translate(113.63-359.13)"> <use fill="#f00" xlink:href="#D"/> <g transform="translate(72.59-8.504)"> <use xlink:href="#E"/> <path fill="#f00" stroke="#000" stroke-linejoin="round" stroke-linecap="round" stroke-width=".24" d="m6.04 526.26h19.843v4.961h-19.843z"/> <use xlink:href="#F"/> </g> <text x="20.41" y="527.6" fill="#000" font-family="Arial" font-size="8">ProcessOutbound</text> </g> </svg> which can be found by this Xpath /svg/g[text=