xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian" <bryha...@yahoo.com>
Subject XSL newbie - way to do dynamic variables?
Date Mon, 03 May 2004 15:21:09 GMT
given this simple XML

-----------------------------------------------

<product>
	<color>red</color>
	<name>car</name>
</product>

-----------------------------------------------

i want to call a XSL template and pass the tag name as dynamic variable - so
the temlate being called can process a variety of incoming XML and give the
same result HTML

-----------------------------------------------

<xsl:call-template name="doThis">
	<xsl:with-param name="pageBody" select="product"/>
	<xsl:with-param name="field1" select="name"/>
	<xsl:with-param name="field2" select="color"/>
</xsl:call-template>

-----------------------------------------------

so that if dynamic vars would work (showing it like a php $$) it would look
something like this (of course this doesnt work)...

-----------------------------------------------

<xsl:param name="pageBody"/>
<xsl:param name="field1"/>
<xsl:param name="field2"/>

<xsl:value-of select="$field1"/> : <xsl:value-of select="$$field1"/>
<xsl:value-of select="$field2"/> : <xsl:value-of select="$$field2"/>

-----------------------------------------------

so the output would be something like
name : car
color : red

i could even live with reformatting the input XML and placing it into a
variable in the format that the calling template would expect - but i
couldnt get the variable/parameter to parse as XML into the calling template

any help?

thanks,
Brian...


Mime
View raw message