Subject: [xsl] Problem processing unescaped nested span TEXT with parse-xml-fragment From: "rus tle profrustyleafiii@xxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 4 Apr 2019 10:46:57 -0000 |
Hello All, I am struggling a bit with the parse-xml-fragment function and was wondering if anyone could help. Spans are being used in our application due to their nesting features (spans within spans). However, they are escaped by a different process before they come to the XSLT process and so are presented as unescaped TEXT. Because of this, we are using parse-xml-fragment to pull out unescaped TEXT and turn it back into markup content and it has worked fine because we have not hit any nested spans. But today we did. I am wondering if there is a better way anyone could think about to revert unescaped nested spans back into markup content (i.e their spans). I would be grateful for any suggestions! The stylesheet code looks like this: <xsl:variable name="FRAGMENTTEXT" select="./Content/Fragment[contains(text(), '<span ')]"/> <xsl:if test="$FRAGMENTTEXT!=''"> <xsl:variable select="parse-xml-fragment($FRAGMENTTEXT)" name="UNESCAPEDTEXT"/> <xsl:call-template name="annotations"> <xsl:with-param select="$UNESCAPEDTEXT" name="UNESCAPEDTEXT"/> <xsl:with-param select="." name="EVENT"/> </xsl:call-template> </xsl:if> Unescaped FRAGMENT TEXT example: <Fragment><span><span class="meta" cid="2">sassafras plant</span> is a slightly black oil called <span class="meta" cid="3">safrole</span>. Synthetic manufacturing methods are used to convert the safrole to <span class="meta" cid="4">MDMA</span>. Relative small amounts are required to create large amounts of <span class="meta" cid="5">ecstacy</span> pills.</span></Fragment> Unescaped the Fragment looks like this: <span> <span class="meta" cid="2">sassafras plant</span> is a slightly black oil called <span class="meta" cid="3">safrole</span>. Synthetic manufacturing methods are used to convert the safrole to <span class="meta" cid="4">MDMA</span> . Relative small amounts are required to create large amounts of <span class="meta" cid="5">ecstacy</span> pills. </span> The error: Severity: fatal Description: A sequence of more than one item is not allowed as the first argument of fn:parse-xml-fragment() ("In the rain forests of <span c...", "<span><span class="meta" cid="...") Current Environment setup: <?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml"><head><title>XSLT Processor Version</title></head><body><p>XSL version: 3.0</p><p>Vendor: Saxonica</p><p>Vendor URL: http://www.saxonica.com/</p><p>Product name: SAXON</p><p>Product version: PE 9.8.0.12</p><p>Is schema-aware: no</p><p>Supports serialization: yes</p><p>Supports backwards compatibility: yes</p></body></html> Many thanks, Rusty
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSL-List Guidelines, Tommie Usdin btusdin | Thread | Re: [xsl] Problem processing unesca, Martin Honnen martin |
[xsl] XSL-List Guidelines, Tommie Usdin btusdin | Date | Re: [xsl] Problem processing unesca, Martin Honnen martin |
Month |