xsl-list
[Top] [All Lists]

RE: Still battling with practical strategy for parsing escaped XML inside unescaped XML

2003-07-30 05:40:37
Hi.

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Karr, David
Sent: Tuesday, July 29, 2003 5:56 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Still battling with practical strategy for 
parsing escaped XML inside unescaped XML


(...)
I don't think it will do much good to change how I iterate 
through the variable, because the error occurs on the 
assignment to the variable, which is before the "for-each".

I also already tried changing your script to call "node-set" 
on the return value.

I changed this in your original script:

      <xsl:otherwise>
        <xsl:value-of select="$str"/>
      </xsl:otherwise>

to:

      <xsl:otherwise>
        <xsl:value-of select="xalan:nodeset($str)"/>
      </xsl:otherwise>


The stylesheet I provided worked only with strings, it doesn't have any
node, just text that looks like markup, there for you can not do
xalan:nodeset($str), it will be the same as doing
xalan:nodeset("<sometag>opps</sometag>"). It won't work. What you need to do
is to apply those templates inside the definition of a variable and use the
xalan:nodeset() on that variable.

Something like:
<xsl:variable name="mymarkup">
  <xsl:call-template name="unescape">
    <xsl:with-param name="str" select="value"/>
  </xsl:call-template>
</xsl:variable>

 <xsl:for-each select="xalan:nodeset($mymarkup)">
Or
 <xsl:apply-templates select="xalan:nodeset($mymarkup)"/>

You have to be sure that the string you pass to it is a well-formed xml text
representation

Hope this help

Regards,
Américo Albuquerque




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>