I'm needing to use the XSLT "substring-before" and "substring-after" functions to parse an XPATH value that is delimted by Carriage Returns. For a simple example, assuming I have a value in a XML document with a "comments" element that comes in as:
<comments>
Hello
World
</comments>
In this case, the words "Hello" and "World" are separated by a carriage return. I need to transform the <comments> element into <comments1> and <comments2> in my target XML doc. I need the word "Hello" to display in <comments1> and "World" to display in <comments2>
Assume I assign the value from the <comments> element to a variable named "var1":
<xsl:variable name='var1' select="//comments"/>
In order to get the value "Hello" that comes before the carriage return, I've tried using:
select="substring-before($var1, '#x0D')"
But that does not work. I've also tried it with the delimeter "#xD" and "\r", but they don't work either. Does anyone know how to do this?
<comments>
Hello
World
</comments>
In this case, the words "Hello" and "World" are separated by a carriage return. I need to transform the <comments> element into <comments1> and <comments2> in my target XML doc. I need the word "Hello" to display in <comments1> and "World" to display in <comments2>
Assume I assign the value from the <comments> element to a variable named "var1":
<xsl:variable name='var1' select="//comments"/>
In order to get the value "Hello" that comes before the carriage return, I've tried using:
select="substring-before($var1, '#x0D')"
But that does not work. I've also tried it with the delimeter "#xD" and "\r", but they don't work either. Does anyone know how to do this?