SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: XSL and XML

  1. #1
    SitePoint Addict
    Join Date
    Jun 2008
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XSL and XML

    The XML format is like this

    Code:
      <cc:correction date='20090303' type='text'>AAA</cc:correction><cc:correction date='20090308' type='text'>BBB</cc:correction>
    <xsl:apply-templates select="ci:correction"/>

    XSL is as below.



    Code:
    <xsl:template match="cc:correction">
            <p:metadata name="correction"><xsl:value-of select="."/></m:metadata>
    </xsl:template>
    The attribute value only AAA is stored.
    How to loop throught the XML and store the value of "date" attribute for each <cc:correction>

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2009
    Location
    Bavaria, Germany
    Posts
    106
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <xsl:value-of select="."/>
    with that code you only select one element. if you want to loop through elements have a look at

    Code:
    <xsl:for-each select="[xyz]">
      <xsl:value-of select="."/>
    </xsl:for-each>


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
  •