hi,

i'm really a newbie in xslt. i try to add string to a variable using concat (there is some how my xslt processor doesn't know string-join, but that's not the point here =P)

this is some part of xml code

<node0>
		<node1>
                                                <node1name>xxxx</node1name>
			<node2>
				<node3>01</node3>
			</node2>
			<node2>
				<node3>02</node3>
			</node2>
		</node1>
		<node1>
                                                <node1name>yyyy</node1name>
			<node2>
				<node3>03</node3>
			</node2>
		</node1>
		<node1>
                                                <node1name>zzzz</node1name>
			<node2>
				<node3>04</node3>
			</node2>
		</node1>
</node0>

this is some part of xslt code

<!-- i select $copareName before and test it already. its value is 'xxxx' -->
<xsl:variable name="strTest" select="''" />
<xsl:for-each select="//node2[parent::node()/node1name=$copareName]">
     <xsl:variable name="tmp" select="node3" />
     <xsl:variable name="strTest" select="concat($strTest, '/', $tmp)" />
</xsl:for-each>
<xsl:variable name="strTest" select="concat($strTest, '/')" />
<xsl:value-of select="strTest" /><!-- the result from this line is nothing. -->

if everything works fine, the result will be
/01/02/


i also try recursive concat using xsl:template, but that make me even more confuse :S
Sitting and coding from 12 to 7pm, still couldn't understand why this doesn't work.

anyone pls help me. my assignment deadline is coming real soon. T-T

Okay, I just find out that XSLT is declarative, not procedural. - -"
So, that's why i cannot change variable that's already declared.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.