xslt-1.0

Using xslt get node value at X position

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 17:50:37
问题 How can I get using xslt, node value at X position, without using foreach <items> <item1>x</item1> <item2>x</item2> <item3>x</item3> </items> This is explained in programming sense: <xsl:value-of select="Items/Item[2]"/> ================================================== Just to little expand question, in the following xml: <items> <about>xyz</about> <item1> <title>t1</title> <body>b1</body> </item1> <item2> <title>t2</title> <body>b2</body> </item2> <item3> <title>3</title> <body>3</body> <

“Regular expression”-style replace in XSLT 1.0

断了今生、忘了曾经 提交于 2019-12-03 16:41:55
I need to perform a find and replace using XSLT 1.0 which is really suited to regular expressions. Unfortunately these aren't available in 1.0 and I'm also unable to use any extension libraries such as EXSLT due to security settings I can't change. The string I'm working with looks like: 19;#John Smith;#17;#Ben Reynolds;#1;#Terry Jackson I need to replace the numbers and ; # characters with a , . For example the above would change to: John Smith, Ben Reynolds, Terry Jackson I know a recursive string function is required, probably using substring and translate, but I'm not sure where to start

xsl trying to ouput '<' as opposed to '<'

你离开我真会死。 提交于 2019-12-03 15:05:57
Update: The issue still persists although it is not quite the same as before. Below is an example of what is being input, what is being output and what I want to have output An example of the input: &lt;p&gt;&lt;span style=&quot;font-size: medium&quot;&gt;Product description text&lt;/span&gt;&lt;/p&gt; Current output: <p><span style="font-size: medium">Product description text</span></p> Intended output: <p><span style="font-size: medium">Product description text</span></p> . Using CDATA has helped as it allows me to input '<' but as seen in the output above, even when using disable-output

What this stands for in xsl? match=“@*|node()”

半城伤御伤魂 提交于 2019-12-03 14:29:47
Can anyone explain what this means in xsl? Exactly what does each expression stands for <xsl:template match="@*|node()"> @* matches any attribute node, and node() matches any other kind of node (element, text node, processing instruction or comment). So a template matching @*|node() will apply to any node that is not consumed by a more specific template. The most common example of this is the identity template <xsl:template match="@*|node()"> <xsl:copy><xsl:apply-templates select="@*|node()" /></xsl:copy> </xsl:template> which copies the input XML to the output tree verbatim. You can then

Get file name using xsl

隐身守侯 提交于 2019-12-03 11:48:50
How can I get the file name using xsl 1.0? I tried <xsl:value-of select="base-uri()" /> but got "Fatal Error! Could not find function: base-uri" There is no such XPath function, or XSLT extension to XPath function to do this in XSLT v1/XPath v1. It is quite possible for there to be no file, and even if there is no reason for the XSLT engine to have that file name (consider loading the file content into a buffer, parsing the buffer into a DOM and then passing the DOM to the XSLT processor). You will need to pass the filename into the processor to be available as a parameter in the transform.

Using xslt get node value at X position

痞子三分冷 提交于 2019-12-03 07:24:53
How can I get using xslt, node value at X position, without using foreach <items> <item1>x</item1> <item2>x</item2> <item3>x</item3> </items> This is explained in programming sense: <xsl:value-of select="Items/Item[2]"/> ================================================== Just to little expand question, in the following xml: <items> <about>xyz</about> <item1> <title>t1</title> <body>b1</body> </item1> <item2> <title>t2</title> <body>b2</body> </item2> <item3> <title>3</title> <body>3</body> </item3> </items> How can I select second's item title. Answer to expanded question. You can use the

XSLT xsl:sequence. What is it good for..?

烈酒焚心 提交于 2019-12-03 04:57:59
问题 I know the following question is a little bit of beginners but I need your help to understand a basic concept. I would like to say first that I'm a XSLT programmer for 3 years and yet there are some new and quite basics things I've been learning here I never knew (In my job anyone learns how to program alone, there is no course involved). My question is: What is the usage of xsl:sequence ? I have been using xsl:copy-of in order to copy node as is, xsl:apply-templates in order to modifiy nodes

XSLT 1.0 textlist to individual elements and duplicate removal

瘦欲@ 提交于 2019-12-03 00:24:12
问题 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

XSLT transform not providing correct output

自作多情 提交于 2019-12-02 23:49:14
问题 I'm having a slight problem with my XSLT transform. I have the following XSLT; <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><!-- removes the unrelated elements --> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="master_version[not(ORDER = //order/ORDERPK)]"/> <xsl:template match="press_section[not(ORDER = //order/ORDERPK)]"/> <xsl

How to transform string equation to number?

这一生的挚爱 提交于 2019-12-02 22:08:00
问题 I generated by a for each the following field: 214.2+428.4+end I have used substring-before(prices,'+end') but this is a string. Any ideas how I can take the 214.2+428.4 and sum it up? input: xml: <items> <item> <price>12.50</price> <quantity>2</quantity> </item> <item> <price>13.20</price> <quantity>3</quantity> </item> </items> xsl: <xsl:variable name="total"><xsl:for-each select="item"><xsl:value-of select="price*quantity"></xsl:value-of><xsl:text>+</xsl:text></xsl:for-each>end </xsl