Copied to clipboard

Flag this post as spam?

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


  • Nicolai Sørensen 42 posts 66 karma points
    May 17, 2013 @ 12:42
    Nicolai Sørensen
    0

    msxsl:node-set shows empty

    I am trying to compary id's one of them from a node-set created like this:

      <xsl:variable name="e">        
        <Item id="1.1.1 aa" txt="aaa" />
        <Item id="1.1.2 bb" txt="bbb" />
        <Item id="1.1.3.d" txt="ccc" />       
      </xsl:variable>
      <xsl:variable name="ext" select="msxsl:node-set($e)" />
    

     

    After comparing and nothing happened when it should, I tried just printing out the node-set and it was empty:

    <xsl:value-of select="$ext"/>
  • Claushingebjerg 919 posts 2521 karma points
    May 17, 2013 @ 13:12
    Claushingebjerg
    0

    You items have no value...

    <xsl:variable name="e">       
    <Item id="1.1.1 aa" txt="aaa">my1</Item>
    <Item id="1.1.2 bb" txt="bbb">my2</Item>
    <Item id="1.1.3.d" txt="ccc">my3</Item>            
    </xsl:variable>

    Returns my1my2my3

     

  • Nicolai Sørensen 42 posts 66 karma points
    May 17, 2013 @ 13:20
    Nicolai Sørensen
    0

    You are my saviour dear sir ;) a great weekend to you!

  • Claushingebjerg 919 posts 2521 karma points
    May 17, 2013 @ 13:29
    Claushingebjerg
    0

    If you need the id attribute, i guess you could do something like:

    <xsl:variable name="e">
    <Item id="1.1.1 aa" txt="aaa">my1</Item>
    <Item id="1.1.2 bb" txt="bbb">my2</Item>
    <Item id="1.1.3.d" txt="ccc">my3</Item>            
    </xsl:variable>

    <xsl:variable name="ext" select="msxsl:node-set($e)" />

    <xsl:for-each select="$ext/Item">
    <xsl:value-of select="@id"/>
    </xsl:for-each>

     

  • Nicolai Sørensen 42 posts 66 karma points
    May 17, 2013 @ 13:43
    Nicolai Sørensen
    0

    Seems to have trouble getting the value when it has same id:

    <xsl:value-of select="$ext/Item[@id = id]/."/>

Please Sign in or register to post replies

Write your reply to:

Draft