[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Passing the current node list
"Paul Ackley" <Paul.Ackley@xxxxxxxxx> wrote: > I would like to know how (or if I even can) pass the current location in the > XML tree from template to template? One possibility is to pass the node as a parameter: <!-- template to be invoked --> <xsl:template match="foo"> <xsl:param name="original-node"/> <!-- refer to $original-node for your node --> </xsl:template> <!-- invokation --> <xsl:template match="bar"> <xsl:apply-templates select="document('foo')/foo"> <xsl:with-param name="original-node" select="."/> </xsl:apply-templates> </xsl:template> Be aware that parameters are not passed through built-in templates, they will be dropped without notice. If necessary, define a catch-all template: <xsl:template match="*"> <xsl:param name="original-node"/> <xsl:apply-templates> <xsl:with-param name="original-node" select="."/> </xsl:apply-templates> </xsl:template> If you have already a catch-all, or if you are using modes, you may have to do more work. There are probably other methods to achieve the effect you want which may be easier to handle in your context. HTH J.Pietschmann XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|