This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Question with xsl:copy-of and xsl:value-of
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] Question with xsl:copy-of and xsl:value-of
- From: "Sullivan, Dan" <dsullivan at develop dot com>
- Date: Thu, 6 Sep 2001 06:57:26 -0700
- Reply-To: xsl-list at lists dot mulberrytech dot com
You can use an identity transform to do this. For example here is a
stylesheet that extracts the info you are looking for.
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/resource">
<result>
<xsl:apply-templates select="title/node()"/>
</result>
</xsl:template>
</xsl:stylesheet>
Dan
-----Original Message-----
From: wbchmura@Ensign-BickfordInd.com
[mailto:wbchmura@Ensign-BickfordInd.com]
Sent: Thursday, September 06, 2001 9:49 AM
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] Question with xsl:copy-of and xsl:value-of
Hi All,
I have a XML file that contains lines like:
<resource name="p_msc" type="packagingbulletin" format="pdf">
<title>P <small><sup>®</sup></small> MS (MSC) series
Canadian
Packaging Bulletin</title>
<link>pkb_can_msc.pdf</link>
</resource>
I need to extact the contents of the <title> tag intact. If I do a
value-of, it looses the tags inside of it. If I do a copy-of I get the
<title> tag also. I need to be able to just get the contents of the
<title> tag without the <title> around it.
Any help would be greatly appreciated
thanks
Bill Chmura
Ensign-Bickford Industries, Inc.
Information Technologies Department
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list