Subject: Re: Suppressing source tree content From: "John E. Simpson" <simpson@xxxxxxxxxxx> Date: Mon, 12 Apr 1999 13:32:46 -0400 |
At 09:22 AM 4/12/1999 -0700, Sara Mitchell wrote: >I had a problem like this in the prototype I put together. The >answer I came up with may not be the most elegant, but it worked >(at least in LotusXsl which is the tool I was using). I simply >output a comment instead of outputing the content. It looked like >this: > ><xsl:template match="para[@userlevel='NOVICE']"> > <xsl:comment>Novice level information skipped. > </xsl:comment> ></xsl:template> > >[I] wrote: >> Is there any way to suppress nodes in the source tree so they're not copied >> to the result? I did learn something interesting, which led me to a solution. Looked at the XSL DTD in the Working Draft; it turns out that the <xsl:template> element may be empty -- that is, that the inclusion of a template (action) in the template rule is optional. If you use a match pattern with no template for the element(s) you want to suppress, then nothing is produced for those element(s). In the case of your example, this would be: <xsl:template match="para[@userlevel='NOVICE']"> </xsl:template> Actually, I kind of like your idea of a generated comment for some cases, as it clearly documents in the result tree that something WAS in the source but is omitted by intent. Thanks for the suggestion. ============================================================= John E. Simpson | It's no disgrace t'be poor, simpson@xxxxxxxxxxx | but it might as well be. | -- "Kin" Hubbard XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Suppressing source tree content, Sara Mitchell | Thread | expression hell, Mark D. Anderson |
Re: Almost XLink..., Simon St.Laurent | Date | RE: SUMMARY: XML Validation Issues , Jelks Cabaniss |
Month |