xsl-list
[Top] [All Lists]

Re: xsl:copy with 'exclude'

2004-12-26 23:28:12
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(_at_)autonomic(_dot_)net 
<ben(_at_)autonomic(_dot_)net> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>