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

xsltサンプル:apply-template のバックアップの現在との差分(No.1)


  • 追加された行はこの色です。
  • 削除された行はこの色です。
*xsltサンプル:apply-template [#rcfc93d1]

apply-templateのサンプルです。

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

ちなみに、xsltにかける対象はこのサイトの[[rss:http://www.hiihah.info/index.php?cmd=rss&ver=1.0]]です。

■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>