xslt-2.0

xsl: how to split strings?

半城伤御伤魂 提交于 2020-02-09 01:09:06
问题 I want to split an address on semicolons ( ; ) into rows separated by <br /> : e.g. if address = 123 Elm Street , I want to output 123 Elm Street , but if address = 123 Elm Street;PO Box 222 , I want to output 123 Elm Street<br />PO Box 222 and if address = 123 Elm Street;PO Box 222;c/o James Jones , I want to output 123 Elm Street<br />PO Box 222<br />c/o James Jones Is there a way to do this? (probably easy but I'm not that familiar with XSLT) The plain XSL selector is <xsl:value-of select=

Count the lines after grouping data in XSLT

回眸只為那壹抹淺笑 提交于 2020-02-07 02:35:25
问题 I need to get the number of rows in the output after the data have been grouped. XML input file looks like this: <?xml version='1.0' encoding='UTF-8'?> <root> <entry> <ID>T-1149</ID> <Item_ID>FM1</Item_ID> <Item_Amount> <Amount>20.00</Amount> </Item_Amount> </entry> <entry> <ID>T-1149</ID> <Item_ID>FM1</Item_ID> <Item_Amount> <Amount>10.00</Amount> </Item_Amount> </entry> <entry> <ID>T-1142</ID> <Item_ID>FM1</Item_ID> <Item_Amount> <Amount>10.00</Amount> </Item_Amount> </entry> <entry> <ID>T

XSLT 2.0 moving a node (created in first step of a multi-step transformation)

自作多情 提交于 2020-02-06 13:10:02
问题 XML and the XSLT 2.0 files for this question are found at https://xsltfiddle.liberty-development.net/6qVRKwX/3 I am trying to 'move' an element ahead of outputting a section of HTML. This element was created during the first part of the transformation) using @mode to insert footnote numbers into the text. The first mode fn-add-marker creates <fn-marker/> to hold the footnote number. The second mode number then inserts incremented footnote numbers. All of this works fine (through to line 52

XSLT 2.0 moving a node (created in first step of a multi-step transformation)

岁酱吖の 提交于 2020-02-06 13:09:24
问题 XML and the XSLT 2.0 files for this question are found at https://xsltfiddle.liberty-development.net/6qVRKwX/3 I am trying to 'move' an element ahead of outputting a section of HTML. This element was created during the first part of the transformation) using @mode to insert footnote numbers into the text. The first mode fn-add-marker creates <fn-marker/> to hold the footnote number. The second mode number then inserts incremented footnote numbers. All of this works fine (through to line 52

How to use for loop in XSLT and get node values based on the iteration

倖福魔咒の 提交于 2020-02-04 05:57:41
问题 How do we use for loop in XSLT? I have this requirement where I want to convert the below shown xml into a comma separated file. Number of rows in CSV file would be equal to count of COBRA_Records_within_Range nodes for an employee's report entry. All values in 3 rows will be same except the child element values for COBRA_Records_within_Range nodes. I am able to create 3 rows but not able to retrieve the value for child elements of COBRA_Records_within_Range . I want to run the for loop on a

How to access previous and next item based on a condition

╄→尐↘猪︶ㄣ 提交于 2020-01-25 08:34:06
问题 I have 2000 TEI-XML-files with letters between different people and a single person in a single folder. I can access the previous and next letter chronologically as the filename starts with the date of the sender (e.g. 2001-02-21.xml). But what I want to achieve is to create an XSLT (2 or 3, doesn't matter) that writes the next letter to or from the specific writer/receiver into the xml-file. Say I have this: <correspDesc> <correspAction type="sent"> <persName key="CMvW">Carl Maria von Weber<

How to add a delimiter between each element in a for-each loop?

扶醉桌前 提交于 2020-01-25 02:49:05
问题 I am looping through each element in a list and outputting a certain value: <xsl:for-each select="properties/property"> <xsl:value-of select="name"/> </xsl:for-each> This simply outputs a concatenation of the name node of property. I want to add delimiter, such as ; between each element. How can this be done? I listed XSLT versions 1.0, 2.0 and 3.0 as functionalities might differ between different versions. 回答1: If you are using XSLT 2.0 or above, you can drop the xsl:for-each and just do it

xsl:character-map to replace special characters

大憨熊 提交于 2020-01-23 09:29:06
问题 Given an element with a value of: <xml_element>Distrib = SU & Prem &lt;&gt; 0</xml_element> I need to turn &lt; or &gt; into < or > because a downstream app requires it in this format throughout the entire XML document. I would need this for quotes and apostrophes too. I am tryinging a character-map in XSLT 2.0. <xsl:character-map name="specialchar"> <xsl:output-character character="&apos;" string="&apos;" /> <xsl:output-character character=""" string="&quot;" /> <xsl:output-character

xsl:character-map to replace special characters

偶尔善良 提交于 2020-01-23 09:27:05
问题 Given an element with a value of: <xml_element>Distrib = SU & Prem &lt;&gt; 0</xml_element> I need to turn &lt; or &gt; into < or > because a downstream app requires it in this format throughout the entire XML document. I would need this for quotes and apostrophes too. I am tryinging a character-map in XSLT 2.0. <xsl:character-map name="specialchar"> <xsl:output-character character="&apos;" string="&apos;" /> <xsl:output-character character=""" string="&quot;" /> <xsl:output-character

Adjust an alphabetical index from xml grouping to make columns equal

空扰寡人 提交于 2020-01-17 03:44:10
问题 Here is a scenario where an alphabetical index is created into 3 columns. But, the approach for dividing them into columns has some scope of improvement. Creating alphabetical index with fixed number of columns in XSLT 2.0 In the above scenario, is there a way if the 3 columns can be made as much equal as possible without breaking a letter group. 回答1: I would suggest the following approach: XSLT 2.0 <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output