![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Problem populating a >Thread Next - Re: Problem populating a RE: Problem populating aTo: NULL Date: 11/10/2006 1:41:00 AM I see a problem here <xsl:value-of select="$@Value" /> syntax is false <xsl:value-of select="$Value" /> correct I hope that help you -- My english is (very) rusted, please,don't hesitate to correct me Thanks redacteur/moderateur xml sur developpez.com "PlutoPlanet" wrote: > 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 | |||||
|
