This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Storing HTML in XML


> -----Original Message-----
> From: wbchmura@Ensign-BickfordInd.com

> You want to use:
> 
>  <xsl:copy-of select="title/node()" />
> 
> To get it out.  See the thread "Re: [xsl] Question with 
> xsl:copy-of and xsl:value-of".
> 
> if you dont do it this way it will be outputting <myfile> as 
> part of the 
> result.
> 

I think you are refering to an message from Mike Kay where someone asked how
to extract the contents of the <title> tag with the enclosed nodes intact
from the following XML
<resource name="p_msc" type="packagingbulletin" format="pdf">
  <title>P <small><sup>&#174;</sup></small>  MS (MSC)series Canadian
Packaging Bulletin</title>
  <link>pkb_can_msc.pdf</link>
</resource>

MK> If the <title> is the current node, do <xsl:copy-of select="node()"/> to
MK> copy its children.

He also could have said <xsl:copy-of select="."/>, or equally "If the
<title> ISNT the current node, do <xsl:copy-of select="the_path/title"/> to
copy its children."

In other words, the node() isn't required. - I use copy-of in this way often
and have not needed to use it.

But you have correctly pointed out that to extract the nodes within the
selected element, xsl:value-of won't work, and xsl:copy-of is required to do
a deep copy.

Tim

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]