关于xml与xslt

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="a.xslt"?>
<project>
  <image src="logo.gif" />
  <text>This is content.哈哈</text>
</project>

 

 a.xslt:

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    <html>
    <body>
    <!--
        This is an XSLT template file. Fill in this area with the
        XSL elements which will transform your XML to XHTML.
    -->
      <h1>
        <xsl:value-of select="/project/text" />
      </h1>
      <img border="0">
        <xsl:attribute name="src">
          <xsl:value-of select="/project/image/@src" />
        </xsl:attribute>
      </img>
    </body>
    </html>
</xsl:template>

</xsl:stylesheet>

posted on 2007-10-12 08:50  Timanders  阅读(97)  评论(0)    收藏  举报

导航