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

RE: Still battling with practical strategy for parsing

Subject: RE: Still battling with practical strategy for parsing escaped XML inside unescaped XML
From: Américo Albuquerque <melinor@xxxxxxx>
Date: Tue, 29 Jul 2003 17:13:36 +0100
xsl unescape
Hi

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Karr, David
> Sent: Monday, July 28, 2003 9:37 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  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@xxxxxxx] 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>&lt;control1&gt;VB&lt;/control1&gt;&lt;control2&gt;FC12
> 3&lt;/control2&gt;</value>
>  </other>
>  <other>
>   <key>auditInfo</key>
>   
> <value>&lt;userid&gt;U999999&lt;/userid&gt;&lt;branchnumber&gt
> ;123&lt;/branchnumber&gt;&lt;loannumber&gt;10000003&lt;/loannu
> mber&gt;</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


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.