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: Monday, July 28, 2003 9:37 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Still battling with practical strategy for
parsing escaped XML inside unescaped XML
Ok, I'm now convinced that it's not practical to just use
"disable-output-escaping" to enable parsing of escaped XML
data. It's fine if I just need to print it directly, but it
does me no good if I need to do more with it.
So, I'm now trying to use a small variation of the
"taggifier.xsl" script that Américo Albuquerque
[melinor(_at_)sapo(_dot_)pt] provided in an earlier response to me,
which just uses string searches and manipulation to produce
the result. I've changed the names slightly, and I'm trying
to coerce the final result on completion.
I'm showing here my simple "data.xml" and "filter.xsl" files,
along with the output I get from a "xalan" wrapper script.
It appears that I'm still having trouble with treefrag vs.
nodelist (or nodeset). Note that my code for concatenating
the key and the value in the "for-each" very likely doesn't
work yet, but it doesn't get there yet.
Note that I'm using Xalan 2.5.1 with JDK1.4.1 (I also tried
the same test with JDK1.3.1).
Is this a possible strategy, or is this just as useless as
the "d.o.e" strategy?
------------data.xml---------
<data>
<other>
<key>controlInfo</key>
<value><control1>VB</control1><control2>FC12
3</control2></value>
</other>
<other>
<key>auditInfo</key>
<value><userid>U999999</userid><branchnumber>
;123</branchnumber><loannumber>10000003</loannu
mber></value>
</other>
</data>
------------data.xml---------
-----filter.xsl---------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xslt"
extension-element-prefixes="xalan"
version="1.0">
<xsl:include href="unescaper.xsl"/>
<xsl:output method="xml" indent="yes" xalan:indent-amount="2"/>
<xsl:template match="/">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="data">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<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------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list