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

Subject: RE: [xsl] Still battling with practical strategy for parsing escaped XML inside unescaped XML
From: "Karr, David" <David.Karr@xxxxxxxx>
Date: Tue, 29 Jul 2003 09:55:46 -0700
Comments below.

> -----Original Message-----
> From: Américo Albuquerque [mailto:melinor@xxxxxxx]
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >
> > -----filter.xsl---------
> >
> >   <xsl:template match="other">
> >     <xsl:variable name="keyValue" select="key"/>
> >     <xsl:variable name="values">
> >       <xsl:call-template name="unescape">
> >         <xsl:with-param name="str" select="value"/>
> >       </xsl:call-template>
> >     </xsl:variable>
> 
> Here you have you'll have to use vendor:node-set() function to change from
> rtf to nodelist
> 
> define in your xsl:stylesheet the fn namespace:
> <xsl:stylesheet ...  xmlns:fn="http://exslt.org/common";>
>  ...
>  <xsl:for-each select="fn:node-set($values)">
> 
> >     <xsl:for-each select="$values">
> >       <xsl:value-of select="$keyValue"/>-<xsl:value-of
> > select="name()"/>
> >     </xsl:for-each>
> >   </xsl:template>
> > </xsl:stylesheet>
> > -----filter.xsl---------
> >
> > --------shell output------
> > [;] xalan -IN data.xml -XSL filter.xsl
> >
> file:.../filter4.xsl; Line #23; Column #33;  XSLT Error
> (org.apache.xpath.XPathException): Can not convert #RTREEFRAG to a
> NodeList!
> --------shell output------

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>

I made sure to add the namespace in the stylesheet attributes.  When I did this, it didn't fix the problem.  It didn't even change the error message.

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


Current Thread