Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kasper Dyrvig 246 posts 379 karma points
    Jul 27, 2010 @ 16:36
    Kasper Dyrvig
    0

    Find and display xml-data by the name of the xml-document

    I succesfully got XSLT to find xml-data from the ID that is in the querystring. That's great!

    But... can the same thing be done if it is the name of the xml-document that is in querystring? I have tried different random solutions, but nothing have worked yet. Can you help me? I'm convinst that you can!

    A little tweek for the issue: When the document is found, the data has to be displayed in an easy way...

    Thank you!

  • Kasper Dyrvig 246 posts 379 karma points
    Jul 29, 2010 @ 12:40
    Kasper Dyrvig
    0

    Some one who has an idea for looping through the XML-nodes until it hits the specific nodes name?

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jul 29, 2010 @ 13:39
    Thomas Höhler
    0
    <xsl:value-of select="$currentPage/ancestor-or-self::root/descendant-or-self::node [@nodeName = 'YOURNODENAME']" 

    This selects all nodes in the content tree which has the node name YOURNODENAME.

    Be aware: If you have non unique nodenames you will get more than one node

    hth, Thomas

  • Kasper Dyrvig 246 posts 379 karma points
    Jul 29, 2010 @ 13:59
    Kasper Dyrvig
    0

    Thanks, but I can't make it work...

    Here is some code:

     

    <xsl:choose>

     <xsl:when test="string(umbraco.library:RequestQueryString('name')) != ''">

           <xsl:variable name="qs" select="umbraco.library:RequestQueryString('name')" />

    name="node"

    select="$currentPage/ancestor-or-self::root/descendant-or-self::node

    [@nodeName = $qs]" />

     

     

    <xsl:value-of select="$node/omrdenavn" />

     

     

      xsl:when>

    <xsl:otherwise>

      <h2>

        Error in querystring

      h2>

    xsl:otherwise>

    xsl:choose>

     

     

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jul 29, 2010 @ 14:39
    Thomas Höhler
    0

    Are there error messages?

    A help would be that you output the selected xml via

    <textearea><xsl:copy-of select="$currentPage/ancestor-or-self::root/descendant-or-self::node [@nodeName = 'YOURNODENAME']" /></textarea>

    So you can see what the xpath statement returned

    hth, Thomas

  • Kasper Dyrvig 246 posts 379 karma points
    Jul 30, 2010 @ 08:29
    Kasper Dyrvig
    0

    I don't really get anything... no errors, no nothing. 

  • Kasper Dyrvig 246 posts 379 karma points
    Aug 10, 2010 @ 14:18
    Kasper Dyrvig
    0

    Hallo again. The problem is now solved thanks to Chriztian. http://our.umbraco.org/forum/developers/xslt/11180-Shouldn't-this-be-working

  • Kasper Dyrvig 246 posts 379 karma points
    Aug 13, 2010 @ 09:29
  • Kasper Dyrvig 246 posts 379 karma points
    Aug 13, 2010 @ 09:32
    Kasper Dyrvig
    0

    No, sorry.. everything is i order

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies