xsl:for-each 記述例

ソースXML文書

<?xml version="1.0" encoding="Shift_JIS" ?>
<book>
  <title>XMLマスターとは</title>
  <title>XML概説</title>
  <title>Java&amp;XML</title>
</book>

XSLTスタイルシート
<?xml version="1.0" encoding="Shift_JIS" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <magazine>
      <title-list>
        <xsl:for-each select="book/title" >
          <xsl:value-of select="." />
        </xsl:for-each>
      </title-list>
    </magazine>
  </xsl:template>
</xsl:stylesheet>

結果XML文書
<?xml version="1.0" encoding="UTF-8"?>
<magazine>
 <title-list>
  XMLマスターとは
  XML概説
  Java&XML
 </title-list>
</magazine>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License