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

Discussion in 'XML' started by =?ISO-8859-2?Q?fr=EAdzel?=, Jul 3, 2006.

  1. 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
     
    =?ISO-8859-2?Q?fr=EAdzel?=, Jul 3, 2006
    #1
    1. Advertising

  2. 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/
     
    Martin Honnen, Jul 3, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Geathaa
    Replies:
    2
    Views:
    700
    Geathaa
    Jul 30, 2003
  2. ectoplasm
    Replies:
    12
    Views:
    646
    Zorro
    Jul 28, 2005
  3. thecolour
    Replies:
    0
    Views:
    382
    thecolour
    Jun 26, 2007
  4. thecolour
    Replies:
    2
    Views:
    425
    thecolour
    Jun 27, 2007
  5. njsimha
    Replies:
    0
    Views:
    785
    njsimha
    Sep 16, 2008
Loading...

Share This Page