Copied to clipboard

Flag this post as spam?

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


  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jul 07, 2009 @ 17:10
    Sebastiaan Janssen
    0

    Variable value from macro to xslt

    How do I pass a variable value from my macro (test="blah") to my XSLT?

    I tried to to this with

    <xsl:value-of select="/macro/test"/> 

    But that didn't always give me results when I was looping through subnodes of the content tree.
    So how do I always get a result?

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 07, 2009 @ 17:17
    Peter Dijksterhuis
    100

    Maybe it'd help if you stored it in a variable first?

    <xsl:variable name="test" select="/macro/test"/>

    and then later use

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

     

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Jul 07, 2009 @ 17:19
    Darren Ferguson
    0

    Try:

    <xsl:param name="myParam" select="/macro/test" /><br /><span class="tag"><xsl:value-of</span><span class="pln"> </span><span class="atn">select</span><span class="pun">=</span><span class="atv">"$myParam"</span><span class="tag">/></span><span class="pln"> </span>

     

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Jul 07, 2009 @ 17:20
    Darren Ferguson
    0

    Oops:

    <xsl:param name="myParam" select="/macro/test" />

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

     

     

     

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 07, 2009 @ 17:27
    Peter Dijksterhuis
    0

    Oops, seems my macro-parameter-knowlegde has become a bit rusty. I think Darren is right here......

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jul 07, 2009 @ 17:29
    Sebastiaan Janssen
    0

    D'oh, of course! Thank you guys, that worked perfectly.

  • Darren Ferguson 1022 posts 3259 karma points MVP c-trib
    Jul 07, 2009 @ 17:34
    Darren Ferguson
    1

    hey, you stole my karma ;)

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jul 07, 2009 @ 19:54
    Peter Dijksterhuis
    0

    Hm, I did, didn't I? Perhaphs the forum needs a system where the poster can mark it as 'No solution' or something so the original poster can't accidentally mark it as solution?

Please Sign in or register to post replies

Write your reply to:

Draft