![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - RE: Problem populating a Problem populating aTo: NULL Date: 11/8/2006 12:31:00 AM Hello world, My problem: I need to create a xsl template for a <SELECT>. The template should be re-usable, therefore I tried to pass the attribute's name as param. See the code below. How should I create an xsl template which I can use to populate with both attributes (myValue or myOtherValue). // content of xml file <root> <preselected> <id>1</id> <value>one</value> </preselected> <something> <myexample myId="1" myValue="one" myOtherValue="uno" /> <myexample myId="2" myValue="two" myOtherValue="due" /> </something> </root> // xsl file <xsl:call-template name="TSelect"> <xsl:with-param name="OptionSelected" select="root/preselected/id" /> <xsl:with-param name="Options" select="root/something/myexample" /> <xsl:with-param name="Value" select="'myValue'" /> </xsl:call-template> <xsl:call-template name="TSelect"> <xsl:with-param name="OptionSelected" select="root/preselected/id" /> <xsl:with-param name="Options" select="root/something/myexample" /> <xsl:with-param name="Value" select="'myOtherValue'" /> </xsl:call-template> <xsl:template name="TSelect"> <xsl:param name="OptionSelected" /> <xsl:param name="Options" /> <xsl:param name="Value" /> <select> <xsl:call-template name="TOption"> <xsl:with-param name="OptionSelected" select="$OptionSelected" /> <xsl:with-param name="Options" select="$Options" /> <xsl:with-param name="Value" select="$Value" /> </xsl:call-template> </select> </xsl:template> <xsl:template name="TOption"> <xsl:param name="OptionSelected" /> <xsl:param name="Options" /> <xsl:param name="Value" /> <xsl:for-each select="$Options"> <option value="'whatever'"> <!-- THIS WORKS --> <xsl:value-of select="@myValue" /> <!-- THIS WORKS NOT --> <!-- HOW CAN I MAKE THIS DYNAMICALLY? --> <xsl:value-of select="$@Value" /> </option> </xsl:for-each> </xsl:template> yours, Herwig | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
