Copied to clipboard

Flag this post as spam?

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


  • Mikael Mørup 297 posts 326 karma points
    Jan 15, 2009 @ 13:18
    Mikael Mørup
    0

    XSLT and div tag problem

    Inside an XSLT macro i try to put a div tag around the output of the XSLT.
    But i want the div tags Id to be different, based on a property on the page so i can style it differently

    But when i try to save the XSLT file i get an error:

    "System.Xml.XmlException: The 'div' start tag on line 23 does not match the end tag of 'xsl:when'. Line 24, position 4. "

    So it's like it want the tag to be inside the xsl:when statement, but i must have it after the rest of the xslt because the whole block should be styled by the div tag.

    Is there some obvious way to achieve this that i have overlooked ?






    more "When's" here - left out


    some more XSLT here - left out
    and here the end tag for the above div tak comes:




    Thanks

    Mikael

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jan 15, 2009 @ 13:36
    Peter Dijksterhuis
    0

    Hi Mikael,

    try this:




    Other stuff here



    Hope this helps,

    PeterD

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 15, 2009 @ 13:39
    Dirk De Grave
    0

    Hi Mikael,

    I'm pretty sure the closing div should be in the




    ...
    [/code]

    Hope this helps.

    Regards,
    /Dirk

  • Mikael Mørup 297 posts 326 karma points
    Jan 15, 2009 @ 13:52
    Mikael Mørup
    0

    Brilliant.

    That works like a charm.

    Can this be done with all attributes of all tags?


    Thanks

    Mikael

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Jan 15, 2009 @ 14:16
    Peter Dijksterhuis
    0

    I think so yes, as long as you put the xsl:attribute in between the start and end-tag of the tag.

    PeterD

  • Christian Palm 278 posts 273 karma points
    Jan 15, 2009 @ 14:50
    Christian Palm
    0

    PeterD method are working just fine, but I would for simplicity and my coding style have done it a little different.

    My prefered method
    [code]


    Content of div
    [/code]

    Alternate method[code]


    Content of div
    [/code]

  • Mikael Mørup 297 posts 326 karma points
    Jan 15, 2009 @ 15:01
    Mikael Mørup
    0

    Thanks all.

    i'm learning a lot here :-)

    Mikael

Please Sign in or register to post replies

Write your reply to:

Draft