Re: [xsl] Value-of, copy-of

Subject: Re: [xsl] Value-of, copy-of
From: "cutlass" <cutlass@xxxxxxxxxxx>
Date: Wed, 27 Feb 2002 14:46:43 -0000
----- Original Message -----
From: "Eric Vitiello" <xsl-list@xxxxxxxxxxxx>


> ok.
>
> so awhile back we had a somewhat heated discussion of value-of/copy-of,
and where the line is drawn between content and structure.
>
> taking the discussion to heart, I evaluated my practice of using CDATA
blocks to enclose data which I felt was not part of the structure, and using
value-of, with disable-output-escaping="yes", and have switched some of my
data to a CDATA-less layout, and I'm attempting to convert the style sheets
to use copy-of.  I have the following XML (this is a small portion of it):
>
> <?xml version="1.0"?>
> <rdf:RDF
> xmlns:dc="http://purl.org/dc/elements/1.1/";
> xmlns="http://purl.org/rss/1.0/";
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
> xmlns:sy="http://purl.org/rss/1.0/modules/syndication/";>
> <item>
> <title>Rebuilding of the website</title>
> <description>
> <p>this website has now been rebuilt.  We're using an all-css all-the-time
layout.  The backend articles is now in formatted with <acronym
title="Resource Description Format">RDF</acronym>, ready for
syndication.</p>
> </description>
> <dc:date>2002-02-26</dc:date>
> <dc:language>en</dc:language>
> <dc:source></dc:source>
> <dc:creator></dc:creator>
> <dc:contributor>Eric</dc:contributor>
> </item>
> </rdf:RDF>
>
>
> the chunk of XSL in question is:
>
> <div class="blurb">
> <xsl:copy-of select="rss:description"/>
> </div>
>
> my problem is that the processor output is:
>
> <div class="blurb">
> <description xmlns="http://purl.org/rss/1.0/";
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/";>
> <p>this website has now been rebuilt.  We're using an all-css all-the-time
layout.  The backend articles is now in formatted with <acronym
title="Resource Description Format">RDF</acronym>, ready for
syndication.</p>
> </description>
> </div>
>
>
> I don't want it to output the <description> elements, only the content
inside.
>

try something like this........untested

xsl file
----------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

xmlns:rss="http://purl.org/rss/1.0/";

>
 <xsl:template match="/">

<div class="blurb">
<xsl:value-of select="//rss:description/*"/>
</div>

 </xsl:template>
</xsl:stylesheet>



xml file
------------------------------------------

<?xml version="1.0"?>
<rdf:RDF
xmlns:dc="http://purl.org/dc/elements/1.1/";
xmlns="http://purl.org/rss/1.0/";
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/";>
<item>
<title>Rebuilding of the website</title>
<description>
<p>this website has now been rebuilt.  We're using an all-css all-the-time
layout.  The backend articles is now in formatted with <acronym
title="Resource Description Format">RDF</acronym>, ready for
syndication.</p>
</description>
<dc:date>2002-02-26</dc:date>
<dc:language>en</dc:language>
<dc:source></dc:source>
<dc:creator></dc:creator>
<dc:contributor>Eric</dc:contributor>
</item>
</rdf:RDF>


cheers, jim fuller
> I've tried using child::rss:description  and descendant::rss:description,
but I get exactly the same output.  I'm also a bit annoyed by it putting the
namespace declarations in the output, but I think it's probably a simple
namespace mixup.
>
> I have the following namespaces defined in the XSL:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> xmlns:rss="http://purl.org/rss/1.0/";
> xmlns:dc="http://purl.org/dc/elements/1.1/";
> xmlns="http://www.w3.org/1999/xhtml";>
>
>
> I wasn't able to find anything dealing with this value-of and copy-of
issue anywhere.
>
> I'm just learning to deal with namespaces, so bear with me!
>
>
> ---
> Eric Vitiello
> Perceive Designs
> <www.perceive.net>
>
>
>
>  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