xslt-1.0

Percent-encoding using XSLT 1.0

自古美人都是妖i 提交于 2019-12-02 19:08:34
问题 I am using XSLT 1.0 and I am not supposed to use XSLT 2.0. I have the following xml in which the value of <prvNum> has some special characters. <?xml version="1.0" encoding="UTF-8"?> <root> <prvNum>SPECIAL#1&</prvNum> </root> Now I want to perform percent-encoding for the value of <prvNum> . For example the value should be changed as below after percent encoding: SPECIAL%231%26 I am trying with the following code snippet, but the stylesheet is not compiling. <?xml version="1.0" encoding="UTF

XSLT: How to find the count of unique children of a node?

旧街凉风 提交于 2019-12-02 18:44:56
问题 My XML looks like this: <foo> <bar name="a"> <baz name="xyz"> <time>2</time> <date>3</date> </baz> </bar> <bar name="b"> <baz name="xyz"> <time>2</time> <date>3</date> </baz> </bar> <bar name="c"> <baz name="xyz"> <time>2</time> <date>3</date> </baz> </bar> </foo> I am writing an XSL that needs to function like this: If all the baz children are same then doSomething else doSomethingElse . My current node is foo . I am new to XSLT and I am aware of the conditionals in XSL. It looks something

Split XML file into multiple files using XSLT

六眼飞鱼酱① 提交于 2019-12-02 18:07:38
问题 I am having trouble splitting an XML file into multiple files using XSLT. I've tried splitting the file based on the attached XSLT code. I've succeeded in getting the file to split. However, I haven't been able to figure out how to replicate the file and create one for each in the original file. <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" indent="yes" name="xml"/> <xsl:template match="/"> <xsl

String replace and concatenation

帅比萌擦擦* 提交于 2019-12-02 18:06:42
问题 I have this structure <ROWS> <ROW> <TEXT> This is a @good@ @day@ </TEXT> <good>great</good> <day>month</day> </ROW> <ROW> <TEXT> This is a @good@ @day@ </TEXT> <good>Fun</good> <day>morning</day> </ROW> </ROWS> How do I change that to <statement> This is a great month, this is a Fun morning </statement> Using only XSLT 1.0? The original XML can change tag name. But not the structure! Any ideas? 回答1: This seems somewhat similar to creating form letters from a template. Assuming the example is

Change values in XML based to those referenced in another XML file based on multiple match criteria

妖精的绣舞 提交于 2019-12-02 17:07:19
问题 I have a large XML file and need to change certain values to those in another XML document based on multiple matching criteria. My large XML file 'file1.xml' is in the following format: <institution> <ukprn>1234</ukprn> <course> <courseID>1</courseID> <courseaim>X99</courseaim> </course> <student> <birthdate>30/10/1985</birthdate> <instance> <OWNINST>1558310|1</OWNINST> <FC>1</FC> <STULOAD>100</STULOAD> <elq>4</elq> <MODE>31</MODE> <StudentOnModule> <MODID>08|29400</MODID> <MODOUT>4</MODOUT>

Take the value next to the last in xslt

柔情痞子 提交于 2019-12-02 17:01:07
问题 <Address> 1234Road Unit 5 Lane Town, City SO1D 23Z Customer No. 12321312312 </Address> <Address> 21321311234Road 1234Road Unit 5 Lane Town, City SO1D 23Z Customer No. 12321312312 </Address> Can anyone help me to take always the value of the postcode which will be always before Customer No.? <xsl:value-of select="substring-before(substring-after(substring-after(substring-after(Address,' '),' '),' '),' ')"/> I have used the above but is not going to work on the second example. Need to find a

trying to insert CDATA section into a xml

南笙酒味 提交于 2019-12-02 16:53:31
问题 Hi I have added the below two xsl text nodes to get CDATA in my output xml <xsl:text disable-output-escaping="yes"><xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text></xsl:text> <xsl:text disable-output-escaping="yes"><xsl:text disable-output-escaping="yes">]]></xsl:text></xsl:text> In My output i am getting the below <xsl:text disable-output-escaping="yes"><![CDATA[</xsl:text> <xsl:text disable-output-escaping="yes">]]></xsl:text> I want my output to be like <xsl:text disable-output

How to store value in XSL and syntax for-each?

↘锁芯ラ 提交于 2019-12-02 16:50:20
问题 My request XML is : <?xml version="1.0" encoding="utf-8"?> <test123 class="test" version="str1234"> <Header> <MYD>str1234</MYID> </Header> <Body> <Action method="Request" type="PROV"> <Approval> <Approval1>1234567890</Approval1> <Linked123> <XYZNumber>12345</XYZNumber> </Linked123> <Version>123</Version> <Country level="12" hasModified="true" isSelected="true"> <Year>1999</Year> <Month>Jan</MonthShortName> </Country> <Version>123</Version> <Country level="12" hasModified="true" isSelected=

Grouping flat xml using xslt (muenchian grouping), can't get it to group

…衆ロ難τιáo~ 提交于 2019-12-02 14:54:46
问题 I spent quite some time trying to get muenchian grouping of the below xml to work but I can't get it to work. I tried a number of different ways so posting the most recent attempt probably just confuses anyone trying to help me. :-) Xslt needs to be 1.0 Input file is invoice lines where "invoice header info" is duplicated for each line belonging to a particular invoice. Grouping should be made in field _id, i e value in RESULTSET/ROW"/COL[12]/DATA (e. g. 'C82F1B47-9758-4D18-ABD7-80386385F6AD'

XSLT 1.0 textlist to individual elements and duplicate removal

笑着哭i 提交于 2019-12-02 12:54:34
I have the following XML document: <?xml version="1.0" encoding="UTF-8"?> <cars> <car body="Wagon"> <text>Red</text> </car> <car body="Sedan"> <text>Yellow</text> </car> <car body="Sedan"> <text></text> </car> <car body="Wagon"> <textlist> <text>Red</text> <text>Green</text> <text>Black</text> <text>Blue</text> </textlist> </car> <car body="Sedan"> <textlist> <text>Yellow</text> <text>Orange</text> </textlist> </car> <car body="Fastback"> <textlist> <text>Yellow</text> <text>Red</text> <text>Green</text> <text>Black</text> <text>Blue</text> </textlist> </car> <car body="Fastback"> <textlist>