[xslt] value of a node (name given by param)

  • Thread starter =?ISO-8859-2?Q?fr=EAdzel?=
  • Start date
?

=?ISO-8859-2?Q?fr=EAdzel?=

Hello :)

I have a problem, i have got 2 XML files:

### File 1
<list>
<element>
<id>1</id>
<name>Some text</name>
</element>
<element>
<id>2</id>
<name>Some text</name>
</element>
</list>
###

### File 2
<list>
<element>
<code>A</code>
<name>Some text</name>
</element>
<element>
<code>B</code>
<name>Some text</name>
</element>
</list>
###

Theese xml files are created from a simple SQL SELECT.
The columns 'id' and 'code' are primary keys in theese tables.

I pass the param $PKEY when parsing, for file 1 i pass PKEY="id"
and for file 2 i pass PKEY="code"

Now my XSLT:

<xsl:template match="element">
<a href="?pkey={$PKEY}&amp;pkeyval={????}">action</a>
</xsl:template>


What should I put in place of {????} to get there
for "File 1" the values "1" and "2" and for "File 2"
the values "A" and "B"? In other words, how can I
insert there the value of the node with the name given
by param $PKEY.


Sorry for my english and thanks in advance for any help :)
friendzel
 
M

Martin Honnen

frędzel wrote:

<xsl:template match="element">
<a href="?pkey={$PKEY}&amp;pkeyval={????}">action</a>

pkeyval={*[local-name() = $PKEY]}

should do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top