Originally posted by Harsha Jay: <xsl:template match="//someNode">
Harsha, I believe the "//" in the match is an erroneous use of XPath here. It does not make sense to say that the template will match someNode anywhere at or below the context in which this template may be applied. To match someNode at or below a certain context, you should use XPath in an expression within the body of a template. Caveat Emptor: I am not an expert on XSL, but I am putting forth this answer with the expectation that someone who does know more will affirm or refute these assertions.
Juan Rolando Prieur-Reza, M.S., LSSBB, SCEA, SCBCD, SCWCD, SCJP/1.6, IBM OOAD, SCSA
Hi Harsha, The code <xsl:template match="//someNode"> <xsl:apply-templates select="*|@*"/> </xsl:template> Will select only the children nodes and the attributes of someNode. It WILL NOT selct the PI's and comments. If you need to select these nodes, you would have to use special node tests for them. these are given below comment() processing-instruction() text() So to get everything , the code woudl be <xsl:template match="//someNode"> <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text ()"/> </xsl:template> Hope this helps
Hari Vignesh Padmanaban
posted 16 years ago
Also note, you dont have to use comment()* or processing-instruction()*. The comment() itself will be suficient to let the XSLT processor to display all teh comment instructions under the required node!! this is true for PI and text nodes also !!!
I can't take it! You are too smart for me! Here is the tiny ad: