Copied to clipboard

Flag this post as spam?

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


  • AlexR 39 posts 61 karma points
    Apr 28, 2010 @ 12:40
    AlexR
    0

    What diferense between xsl:variable with select and without select?

    Why the code

      <xsl:variable name="title" select="$node/data[@alias='nodeTitle']">
    </xsl:variable>

    returnt title

     

    but the code

      <xsl:variable name="title">
    <value-of select="$node/data[@alias='nodeTitle']" />
    </xsl:variable>

    return empty ?

     

    I need get $node/data[@alias='nodeTitle'] or $node/@nodeName and the code

      <xsl:variable name="title">
    <xsl:choose>
    <xsl:when test="$node/data[@alias='nodeTitle']">
    <value-of select="$node/data[@alias='nodeTitle']" />
    </xsl:when>
    <xsl:otherwise>
    <xsl:value-of select="$node/@nodeName" />
    </xsl:otherwise>
    </xsl:choose>
    </xsl:variable>

    return empty.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 28, 2010 @ 12:48
    Lee Kelleher
    1

    Hi Alex,

    With your second code snippet, you are missing the "xsl:" namespace prefix, so it doesn't work:

     <xsl:value-of select="$node/data[@alias='nodeTitle']" />

    Cheers, Lee.

  • AlexR 39 posts 61 karma points
    Apr 28, 2010 @ 13:14
    AlexR
    0

    Yes! You are right.

    But why it is compiled whout any error?

    Masaraksh!

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 28, 2010 @ 13:23
    Lee Kelleher
    0

    The reason there is no error... is because, there is no error. The syntax is correct.  As far as the XSLT is concerned the tag you used <value-of ... /> is just arbitrary XML.  Errors will occur if you tried to use an incorrect XSLT tag, i.e. <xsl:whatever> because that isn't defined in the XSLT namespace.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 28, 2010 @ 13:23
    Jan Skovgaard
    1

    Hi

    I'm guessing that you don't get any error since the element is actually being wellformed so the parser does not notice that it should in fact have been prefixed with a namespace.

    /Jan

     

  • Tobias Neugebauer 52 posts 93 karma points
    Apr 28, 2010 @ 13:24
    Tobias Neugebauer
    1

    Hi,

    because this is totally valid xml (xslt) you need to prefix with xsl: that the xslt-processor knows what to do with it.

    Toby

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 28, 2010 @ 13:24
    Jan Skovgaard
    0

    Once again beaten by Lee. Congrats on the MVP status! :-)

    /Jan

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 28, 2010 @ 13:29
    Lee Kelleher
    0

    @Jan: Thank you. Looking forward to finally meeting you at CG10!

Please Sign in or register to post replies

Write your reply to:

Draft