Copied to clipboard

Flag this post as spam?

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


  • Greyhound 102 posts 124 karma points
    May 12, 2011 @ 13:54
    Greyhound
    0

    Multiple parameters in xlst select

    Hi,

    I'm having a conceptual block which I'm hoping someone may be able to help me with.

    I have an sxlt select as follows:

    <xsl:for-each select="$currentPage/rightHandImage/DAMP[@fullMedia]/mediaItem/Image">

    What I'm trying to do is re-use a macro so that I can substitute the rightHandImage with a number of variables to place images on the page.

    If I pass rightHandImages through as a variable then I get a unexpected character error in XSLT as follows:

    <xsl:for-each select="$currentPage/$imageLocation/DAMP[@fullMedia]/mediaItem/Image">

    How should I be preparing my select so that it selects 2 variables?

    Thanks in advance.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    May 12, 2011 @ 14:11
    Tom Fulton
    1

    Hi,

    You can achieve this like so:

    <xsl:for-each select="$currentPage/* [not(@isDoc)][local-name() = $imageLocation]/DAMP[@fullMedia]/mediaItem/Image">

    assuming $imageLocation is a string with the alias of the field you are looking for

    Hope this helps,
    Tom

  • Greyhound 102 posts 124 karma points
    May 12, 2011 @ 14:32
    Greyhound
    0

    Hi Tom,

    Thanks for the code, this works perfectly. I am assuming tha the * [not(@isDoc)]etc means that I'm telling XSLT that the field I'm trying to collect is not part of the default document rather part of the custom element?

    Thanks again.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    May 12, 2011 @ 14:35
    Tom Fulton
    0

    Exactly.  The isDoc attribute appears in the schema on all Document Type nodes to indicate it's a document.  Custom properties don't have it.  Ex:

    <NewsArea id="1053" ..... isDoc="">
      <pageHeadline>...</pageHeadline>
      <bodyText>..</bodyText>
      <NewsItem id="1054" .... isDoc="">
        <newsDate>...</newsDate>
      </NewsItem>
    </NewsArea >

    So to make sure you only retrieve properties in your select statement, you add not(@isDoc)

     

     

  • 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