View Single Post
  #9 (permalink)  
Old November 22nd, 2007, 06:01 AM
RoeZ RoeZ is offline
Authorized User
 
Join Date: Oct 2007
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exslt="http://exslt.org/common"
    extension-element-prefixes="exslt"
>


<xsl:output
    indent="yes"
    method="xml"
    encoding="UTF-8"
    omit-xml-declaration="yes"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
/>


<xsl:template match="/">
    <html>
        <head>
            <title>
                test
            </title>
        </head>
        <body>
      <xsl:call-template name="select">
        <xsl:with-param name="options">
          <option>
            <name>1</name>
            <value>test1</value>
          </option>
          <option>
            <name>2</name>
            <value>test2</value>
          </option>
        </xsl:with-param>
      </xsl:call-template>
        </body>
    </html>
</xsl:template>

<xsl:template name="select">
<xsl:param name="options" />
<xsl:for-each select="exslt:node-set($options)/*">
  <p><xsl:copy-of select="name"/></p>
  <b><xsl:copy-of select="value"/></b>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>
my result is :

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>
                test
            </title>
  </head>
  <body>
    <p></p>
    <b></b>

    <p></p>
    <b></b>
  </body>
</html>
<br />
Reply With Quote