Re: [xsl] xsl:copy with 'exclude'

Subject: Re: [xsl] xsl:copy with 'exclude'
From: Colin Savage <colin.savage@xxxxxxxxx>
Date: Mon, 27 Dec 2004 08:28:12 +0200
You just need to add another template to match the 'filling' tags.
Then when apply templates is used, it will find the most specific
template for a particular node.

so just add this to your identity transform

<xsl:template match="filling"/>

Colin

On Sun, 26 Dec 2004 20:41:48 +0000, ben@xxxxxxxxxxxxx <ben@xxxxxxxxxxxxx> wrote:
> Hello all.
> 
> Here is a predicament. I'm sure, given the right knowledge, that it is simple. Lacking that knowledge, I'm finding it bloody hard!
> 
> For the sake of argument... I have a datastructure like :
> 
> <gui>
> <filling>
> </filling>
> .
> .
> .<---- lots of other stuff
> .
> </gui>
> 
> I would like to copy everything in the gui tags, so I use copy-of. However, I would like to EXCLUDE the <filling> tags.
> 
> I assumed that this would involve some derivative of the identity function,
> 
> <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
>                version="1.0" >
> 
> <xsl:template match="@*|*|processing-instruction()|comment()|text()">
>  <xsl:copy>
>    <xsl:apply-templates select="*|@*|text()|processing-instruction()|comment()" />
>  </xsl:copy>
> </xsl:template>
> 
> where it would use an "if" clause before the inner apply-templates to prevent recursion whenever it was "about to" copy a filling tag. This "about to" is causing me problems. How does the algorithm tell what node it's currently in? If I use value-of then it returns the content of that node.
> 
> Would such an "if" statement approach then be the best way to tackle the problem?
> 
> My apologies if this is a trivial and obvious problem.
> 
> Kindest Regards,
> 
> Ben

Current Thread