Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Xsl problem to find correct nodes using idrefs

Xsl problem to find correct nodes using idrefs

Scheduled Pinned Locked Moved XML / XSL
xmlhelptutoriallearning
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BadKarma
    wrote on last edited by
    #1

    Hi, I have a simple xml-structure to represent my bookcase.

    lib
     + books
       + serie
         + book (aut: type = IDREFS)
           - title
           - pages
     + authors
       + author (id: type = ID)
         - first_name
         - last_name
    

    It contains 2 tables, one of the authors identified with id. And a table with the books with an attribute aut pointing to one or more of the authors. Now i want to show the series, the booktitle and the author(s). The problems is how to show the author and not just the ID in the aut attribute. I have used a named template to find the author

    <xsl:template name="author_name">
      <xsl:param name="idref"/>
      <xsl:for-each select="//author[@id=$idref]">
        <xsl:value-of select="last_name"/> 
        <xsl:value-of select="first_name"/>
      </xsl:for-each>
    </xsl:template>
    

    And I'm using it like this

    <xsl:call-template name="author_name">
      <xsl:with-param name="idref" select="@aut"/>
    </xsl:call-template>
    

    And this works, BUT NOT for books written by 2 or more authors. I have tried tokenize but that function is only available in xls 2.0. And then IE has troubles with it. Any help on this would be appreciated.

    Learn from the mistakes of others, you may not live long enough to make them all yourself.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups