Results 1 to 2 of 2

Thread: DOMXML question

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    DOMXML question

    I am writing a php script to output xml data to html. How can I sort my data in asscending order?

    Thanks in advance..

  2. #2
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    Code:
    For example, suppose an employee database has the following form.
    
    <employees>
      <employee>
        <name>
          <given>James</given>
          <family>Clark</family>
        </name>
        ...
      </employee>
    </employees>
    
    A list of employees sorted by name could be generated using the following.
    
    <xsl:template match="employees">
      <ul>
        <xsl:apply-templates select="employee">
          <xsl:sort select="name/family"/>
          <xsl:sort select="name/given"/>
        </xsl:apply-templates>
      </ul>
    </xsl:template>
    <xsl:template match="employee">
      <li>
        <xsl:value-of select="name/given"/>
        <xsl:text> </xsl:text>
        <xsl:value-of select="name/family"/>
      </li>
    </xsl:template>

Posting Permissions

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



Click Here to Expand Forum to Full Width