[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: working with xsl:comment

Subject: RE: working with xsl:comment
From: "Andrew Welch" <ajwelch@xxxxxxxxxxxxxxx>
Date: Fri, 24 Jun 2005 12:42:49 +0100
xsl comment and td
> Sorry, another query in quick succession but like earlier I might be
> missing something rather obvious.
>
> I am writing some information within the <xsl:comment> tags.
> I want to
> later retreive this content in another .xsl file. How do I do
> it? Also
> can I retrieve the container node of this comment?
>
> E.g <TD width="50%"><FONT SIZE="4" COLOR="red">Checking for
> existence of
> 'Wood'...</FONT>
>                <!--Wood--></TD>
>
> So how do I get the information 'Wood' as well as the position of the
> containing <TD> so that I can proceed to find other sibling
> <TD>s from
> this point?

Use the comment() function eg:

<xsl:template match="comment()">
  <xsl:value-of select="."/>
</xsl:template>

Which will output 'Wood'.  If you want <!--Wood--> then use copy-of
instead of value-of.

To select the TD that contains a comment just use a predicate eg:

<xsl:apply-templates select="TD[comment()]"/>

cheers
andrew

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.