Subject: RE: [xsl] Problem passing value of variable using xsl:call-templa te From: "Crowers, Steve" <scrowers@xxxxxxxxxxxx> Date: Wed, 25 Jul 2001 17:30:43 -0400 |
The answer is that you don't need the xsl:with-param construct to get a value out of a template , only to send one to it...that said, assuming that your XML looks like: <A> <B> <C> <D>D</D> </C> </B> <K> <L> <M>M</M> </L> </K> </A> you may need to pass the current node context to the template in order for it to extract the K/L/M elements from the current "A" node instead of from A/B/C/D/A/K/L/M... <xsl:template match="A/B/C/D"> <xsl:text>111</xsl:text> <xsl:value-of select="E"/> <xsl:call-template name="Take-XYZ"> <xsl:with-param name="CurrNode" select"../../.." </xsl:call-template> </xsl:template> <xsl:template name="Take-XYZ"> <xsl:param name="CurrNode" <xsl:value-of select="$CurrNode/K/L/M"/> </xsl:template> will output: 111<val of "E"><val of "M"> Take a look at Jeni Tennison's site for further explanation: http://sources.redhat.com/ml/xsl-list/2000-07/msg00815.html Steve Crowers Software Engineer Liberate Technologies 2 Walnut Grove, Suite 200 Horsham, PA 19044 Phone: 215-773-9400 x 9514 Fax: 215-773-9401 scrowers@xxxxxxxxxxxx http://www.liberate.com -----Original Message----- From: Alex Genis [mailto:agenis@xxxxxxxx] Sent: Wednesday, July 25, 2001 4:17 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Problem passing value of variable using xsl:call-template Hi everybody ! I have a problem passing value of parametr using xsl:call-template and xsl:with-param. Thanks a lot in advance. Alex. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <xsl:template match="/"> <xsl:apply-templates select="A/B/C/D"> </xsl:apply-templates> </xsl:template> <xsl:template match="A/B/C/D"> <xsl:text>111</xsl:text> <xsl:value-of select="E"/> ...................................... <xsl:call-template name="Take-XYZ"> <xsl:with-param name="XYZ" select=" What should I specifiy here to get result from template Take-XYZ ??????? " /> </xsl:call-template> ...................................... </xsl:template> <xsl:template name="Take-XYZ"> <xsl:param name="XYZ"> <xsl:value-of select="A/K/L/M"/> </xsl:param> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Is a node a first/last ch, Oliver Becker | Thread | [xsl] Re: Is a node a first/last ch, Dimitre Novatchev |
[xsl] Re: producing php with xslt, flourish | Date | Re: [xsl] Is a node a first/last ch, Kevin Nardi |
Month |