[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Problem processing unescaped nested span TEXT with

Subject: Re: Problem processing unescaped nested span TEXT with parse-xml-fragment
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Apr 2019 11:07:37 -0000
Re:  Problem processing unescaped nested span TEXT with
On 04.04.2019 12:47, rus tle profrustyleafiii@xxxxxxxxxxx wrote:

The stylesheet code looks like this:



 <xsl:variable name="FRAGMENTTEXT" select="./Content/Fragment[contains(text(
), '&lt;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>&lt;span&gt;&lt;span class="meta" cid="2"&gt;sassafras
plant&lt;/span&gt; is a slightly black oil called &lt;span class="meta"
cid="3"&gt;safrole&lt;/span&gt;.  Synthetic manufacturing methods are
used to convert the safrole to &lt;span class="meta"
cid="4"&gt;MDMA&lt;/span&gt;. Relative small amounts are required to
create large amounts of &lt;span class="meta"
cid="5"&gt;ecstacy&lt;/span&gt; pills.&lt;/span&gt;</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="...")

Can ./Content/Fragment[contains(text(), '&lt;span ')] select more than one Fragment element?

Then you would need e.g. $FRAGMENTTEXT!parse-xml-fragment(.) to process
them all in one go.

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.