トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS

xsltサンプル:apply-template のバックアップソース(No.1)

*xsltサンプル:apply-template [#rcfc93d1]

apply-templateのサンプルです。

以下に、apply-templateしていないものとしているものを載せます。結果は一緒です。


■apply-templateしてないxsltサンプル
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet version="1.0"  
   xmlns:rss="http://purl.org/rss/1.0/"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
 <xsl:template match="/">
 
      <html>
      <p>xsltサンプル</p>
      <lu>
          <xsl:for-each select="/rdf:RDF/rss:item">
              <li><xsl:value-of select="rss:title/text()" /></li>
          </xsl:for-each>
      </lu>
      </html>
 
 </xsl:template>
 </xsl:stylesheet>


■apply-templateしているxsltサンプル
 <?xml version="1.0" encoding="UTF-8"?>
 <xsl:stylesheet version="1.0"  
   xmlns:rss="http://purl.org/rss/1.0/"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
 <xsl:template match="/">
 
      <html>
      <p>xsltサンプル</p>
      <lu>
      <xsl:apply-templates select="/rdf:RDF/rss:item" />
      </lu>
      </html>
 
 </xsl:template>
 
 <xsl:template match="/rdf:RDF/rss:item">
              <li><xsl:value-of select="rss:title/text()" /></li>
 </xsl:template>
 
 </xsl:stylesheet>