Subject: Re: [xsl] why this stylesheet doesn't work properly? From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 18 Sep 2001 10:42:01 +0100 |
Hi Auguste, > <xsl:template match="/"> > <xsl:for-each select="*"> This template matches the root node. The xsl:for-each selects all the elements that are children of the current node (the root node). This will only select one element, the articleMasterData element. That becomes the current node. You could achieve the same thing by just having a template that matches the articleMasterData element: <xsl:template match="AMD:articleMasterData"> ... </xsl:template> > <xsl:if test="AMD:telegramNumber"> > <xsl:value-of select="."/> > </xsl:if> The xsl:if element doesn't change the current node, so this gives the value of the current node (the articleMasterData element) if it contains an AMD:telegramNumber element. I think you probably want the value of the AMD:telegramNumber element (if it exists), which you should do with just: <xsl:value-of select="AMD:telegramNumber" /> > <xsl:if test="AMD:client"> > <xsl:variable name="mandant" select="."/> > <xsl:number value="$mandant" format="00000000"/> > </xsl:if> You've made the same error here and in the rest of the code. You are setting the $mandant variable here to the current node; I think you want it to be the value of the AMD:client. Also, I think you want to use format-number() here to pad the number with 0s rather than xsl:number. There's no reason to use the variable particularly, but you can do: <xsl:variable name="mandant" select="AMD:client" /> <xsl:value-of select="format-number($mandant, '00000000')" /> Of course this assumes that the AMD:client element holds a number. If you make the same kind of changes to the rest of the stylesheet, then I think it should work better. I hope that helps, 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] why this stylesheet doesn't w, Auguste Oumar | Thread | [xsl] Union of two node-sets not pr, Joel Beach |
Re: [xsl] How do you get the non-tr, Francis Norton | Date | Re: [xsl] Array XSL PROb, Jeni Tennison |
Month |