Re: [xsl] Selectively convert subordinate elements to text

Subject: Re: [xsl] Selectively convert subordinate elements to text
From: Jeff Sese <jsese@xxxxxxxxxxxx>
Date: Fri, 25 May 2007 09:36:48 +0800
Use an empty template rule for the element HIDDEN then apply-templates to the child of widget.

<xsl:template match="widget">
   <xsl:apply-templates/>
</xsl:template>
<xsl:template match="HIDDEN"/>

--
Jeff

Darren Wheatley wrote:
Hi,
I have a fragment something like this:
<widget>This <B>is</B> some <SUP>text</SUP> that I want to convert
<HIDDEN>don't convert this</HIDDEN> to text</widget>
What I want to end up with is this:
This is some text that I want to convert to text
I have tried <xsl:value-of select="."/> but of course that gives me:
This is some text that I want to convert don't convert this to text
Can anyone suggest a way that I can convert the fragment to text while
simultaneously dropping the <HIDDEN> element?
Thanks


D.

Current Thread