Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > [xslt] value of a node (name given by param)

Reply
Thread Tools

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

 
 
=?ISO-8859-2?Q?fr=EAdzel?=
Guest
Posts: n/a
 
      07-03-2006
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

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      07-03-2006


frędzel wrote:


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


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

should do.




--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to select all the node names beneath a given node thecolour XML 2 06-27-2007 10:46 AM
I want to select all the node names beneath a given node thecolour XML 0 06-26-2007 04:01 PM
xsl variable $node/text() but $node can non-node-set help! Tjerk Wolterink XML 2 08-24-2006 03:28 AM
How to set the node indent property between the parent node and the leaf node viveknatani@gmail.com ASP .Net 0 02-13-2006 07:11 PM
Select Node Using position or value of another node. Eddy C XML 6 10-17-2005 11:02 PM



Advertisments