SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2004
    Location
    india
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Xslt -> Appending to a attribute

    Hello everyone,

    I have a list of images that need to be appended to the existing attribute in an xslt template. I am trying to output XHTML. The body tag may already contain some function in the onLoad attribute, so it would be best to just append the images to be preloaded. To get an idea, please see the code below

    <body onLoad="somefunc();">

    <xsl:for-each select="JS/preload_images">
    <xsl:variable name="val2" select="concat(...or something like that...)"/>
    </xsl:for-each>
    <xsl:variable name="attr" select="concat(.,',')"/>
    </body>

    Any help will be appreciated.

    Thanks

    - Metter

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Try something like this instead:
    HTML Code:
    <xsl:template match="body">
    <body>
     <xsl:attribute name="onLoad">
     <!--the line below will grab what you have in 
     the current onLoad attribute and copy it-->
     <xsl:value-of select="@onLoad" />
     <!--
      add whatever you need to here,
      like the loop you have in your other code sample.
      This will be appended to the onLoad attribute.
      -->
     </xsl:attribute>
    </body>
    </xsl:template>

  3. #3
    SitePoint Member
    Join Date
    Jul 2004
    Location
    india
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great, Let me try this. Thanks for your help and time. I really appreciate it :-)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •