xsl-list
[Top] [All Lists]

Re: working with xsl:comment

2005-06-24 04:51:43
Thanks a lot Andrew.

Its working perfectly!

Rahil

Andrew Welch wrote:

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


--~------------------------------------------------------------------
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>