Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl param and concatenation

Status
Not open for further replies.

YYYYUU

Programmer
Dec 13, 2002
47
GB
In my xsl I have the following calls to a template

<xsl:call-template name=&quot;populateFields&quot;>
<xsl:with-param name=&quot;linenum&quot;>1</xsl:with-param>
</xsl:call-template>
<xsl:call-template name=&quot;populateFields&quot;>
<xsl:with-param name=&quot;linenum&quot;>2</xsl:with-param>
</xsl:call-template>
..etc..

I want to get values from xml, for the following
//document/OLD/ADDRESS1
//document/OLD/ADDRESS2

I'm treating the suffix to ADDRESS as the parameter linenum.

How can I get the following to work:
<xsl:template name=&quot;populateFields&quot; >
<xsl:param name=&quot;linenum&quot;/>
... etc ...

<xsl:value-of select=&quot;//document/OLD/ADDRESS{$linenum}&quot;/>
...etc...
<input type=&quot;text&quot; name=&quot;corres1&quot; size=&quot;45&quot; maxlength=&quot;35&quot; value=&quot;{//document/OLD/ADDRESS}{$linenum}&quot;/>
... etc...
</xsl:template>


I want //document/OLD/ADDRESS1 evaluated in both instances.

Thanks for your help.
 
The XML design should be changed. The elements should be the same <ADDRESS> with a sequence attribute to denote sequence <ADDRESS seq=&quot;n&quot;>. This way a simple sort select would produce all the elements for the template in the correct order. Using concatenation to produce an Element name is just not right.

-pete
 
Thanks. I did want to know if this was possible, and I can stop trying now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top