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

RE: processing of xml embedded in string

Subject: RE: processing of xml embedded in string
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 31 Mar 2008 21:10:26 +0800
RE:  processing of xml embedded in string
You need to take the string contained in the text node, and parse it as an
XML document to create a tree of nodes. To do that you need to invoke an XML
parser. There is no standard XSLT facility to do this from within XSLT. You
can do it in Saxon using the saxon:parse() extension function, and in other
products using user-written extension functions.

Michael Kay

> -----Original Message-----
> From: Christian Wittern [mailto:cwittern@xxxxxxxxx] 
> Sent: 31 March 2008 20:39
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  processing of xml embedded in string
> Dear list members,
> Here is the problem I am trying to solve.  I am quite sure 
> this is (almost) a FAQ, but my searches did not turn up 
> anything useful, so here it goes:
> The XML data I am getting back from another process contain 
> is a container that contains some embedded of a completely 
> different kind.  What I want to do is extract this and then 
> process the contained XML as if it where handed to me 
> directly.  To give an example of what I get:
> <str name="textfield">
> &lt;p xmlns="http://www.tei-c.org/ns/1.0" 
> xml:id="pT54p0286b2501"&gt;Some paragraph content here, 
> &lt;note&gt;with possibly other nesting 
> elements&lt;/note&gt;.&lt;/p&gt; </str>
> What I want to do is something like:
>   <xsl:template match="str[@name='textfield']">
>       <xsl:variable name="s">
>       <xsl:value-of select="." disable-output-escaping="yes"/>
>       </xsl:variable>
>       <xsl:apply-templates select="$s"/>
>   </xsl:template>
> and then have another template that matches the content:
> <xsl:template match="tei:p">
>      <p>
>          <h2>TEI paragraph!</h2>
>          <xsl:apply-templates/>
>      </p>
> </xsl:template>
> But this does not work.  How do I achieve this?  Any help appreciated,
> Christian
> -- 
>   Christian Wittern
>   Institute for Research in Humanities, Kyoto University
>   47 Higashiogura-cho, Kitashirakawa, Sakyo-ku, Kyoto 606-8265, JAPAN

Current Thread


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.
First Name
Last Name
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.