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

RE: deep "copy-of" a source fragment

Subject: RE: deep "copy-of" a source fragment
From: "Conal Tuohy" <conalt@xxxxxxxxxxxxxxx>
Date: Wed, 4 Sep 2002 19:30:33 +1200
coldfusion xml copy
Is this what you want?

<xsl:template match="/">
	<xsl:copy-of select="html/body/node()"/>

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Terence
> Kearns
> Sent: Wednesday, 4 September 2002 18:48
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  deep "copy-of" a source fragment
> Hi everyone, I just joined this list so "greetings". I joined because 
> even after reading the entire 
> http://www.dpawson.co.uk/xsl/sect2/N1930.html page on copying, and 
> reading the reference on xsl:copy and xsl:copy-of I am still 
> vexed by an 
> annoying problem. I'm using XALAN through the ColdFusion MX 
> implementation of their xmlTransform() function. I'm not sure exactly 
> which version of Xalan that is.
> I'm trying to deep copy [the _content_ of] an xhtml body 
> element. I have 
> users who enter arbitary HTML which I then pass through HTML 
> TIDY which 
> produces a nice well-formed XHTML document for me. I want to 
> extract the 
> body and store the content only.
> With my existing attempts, I either get a concatenated string 
> of all the 
> leaf text-nodes, or I get the whole entire file.
> Here's what's stange, if I do a
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
>      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>      <xsl:template match="/">
>          <xsl:copy-of select="node()"/>
>      </xsl:template>
> </xsl:stylesheet>
> I get the entire source tree copied to result tree.
> *This is to be expectd*
> but if I change
> 	match="/"
> to
> 	match="/html/body"
> then I get leaf nodes again :(
> I also tried
> match="/html/body/"
> match="/html/body/*"
> match="/html/body/@*|node()"
> match="/html/body/node()"
> no dice... I either get leaf text nodes or the whole entire file.
> makes no difference if I change
> 	select="node()"
> to
> 	select="."
> or
> 	select="@*|node()"
> Is there no way at all to copy a fragment from the source 
> tree onto the 
> result tree?!
> I've also tried a boatload of other things... too many to list...
> I know I can do this using a regular expression instead, but 
> that's not 
> the point, I _should_ be able to do it easily with XSLT.
>  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


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.