[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Stuck on meta-stylesheet problem
Subject: Re: [xsl] Stuck on meta-stylesheet problem From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 23 May 2002 19:40:29 +0100 |
Hi Charles, > In order to get through the first transformation with my product stylesheet > parameter declarations intact, I pull this little kludge in the first > stylesheet: > > <xsl:variable name="v_updateProc">$updateProc</xsl:variable> > <xsl:variable name="v_canEdit"><xsl:copy-of > select="concat('{$','canEdit}')" /></xsl:variable> > <xsl:variable name="v_script"><xsl:copy-of > select="concat('{$','script}')" /></xsl:variable> > <xsl:variable name="v_css"><xsl:copy-of > select="concat('{$','css}')" /></xsl:variable> > <xsl:variable name="v_class"><xsl:copy-of > select="concat('{$','class}')" /></xsl:variable> Assuming you always treat these variables as strings (rather than as result tree fragments that you convert to node sets), these are exactly the same as: <xsl:variable name="v_updateProc" select="'$updateProc'" /> <xsl:variable name="v_canEdit" select="'{$canEdit}'" /> <xsl:variable name="v_script" select="'{$script}'" /> <xsl:variable name="v_css" select="'{$css}'" /> <xsl:variable name="v_class" select="'{$class}'" /> > My problem comes with the "canEdit" parameter. I wish to use its value > to determine whether or not to call a particular template. It's easiest if you work backwards. In the XSLT that's the result of your first stylesheet, you want to have: <xslt:if test="$canEdit = 'true'"> <xslt:call-template name="saveButton" /> </xslt:if> You want the "$canEdit" part of the test to be provided from the $v_canEdit variable in the stylesheet that's generating this XSLT. So the $v_canEdit variable needs to be set to the string '$canEdit': <xsl:variable name="v_canEdit" select="'$canEdit'" /> and the test attribute of the xslt:if literal result element needs to contain an attribute value template that inserts the value of the $v_canEdit variable in place of the "$canEdit" part of the test: <xslt:if test="{$v_canEdit} = 'true'"> <xslt:call-template name="saveButton" /> </xslt:if> You say that you've tried this; all I can tell you is that it should work. If it doesn't, try checking the result that you *are* getting to see what XSLT you're generating to make sure that it's the XSLT you think you're generating, and try running that XSLT alone (and editing it as necessary) to see what that XSLT needs to be in order to work. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Stuck on meta-stylesheet pro, Charles Knell | Thread | Re: [xsl] Stuck on meta-stylesheet , Charles Knell |
Re: [xsl] xsl and <Div> tags - urge, Joerg Heinicke | Date | Re: [xsl] XalanTransformer help nee, Mulberry Technologie |
Month |
Keywords