最初と2番目の見出しを検索するようにxpathを設定しましたが、2番目の見出しは空白になります。これはかなり簡単だと思いますが、パス名を何度も変更しようとしましたが、解決できないようです。おそらく私のxmlファイルが間違っていたかどうかを調べるために、私のループは両方を簡単に見つけるようです。
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:foo="blogschema.xsd"
exclude-result-prefixes="foo">
<xsl:output method ="html" indent ="no"/>
<xsl:template match="/">
<html>
<link rel ="stylesheet" type="text/css" href="blogStyle.css"/>
<body>
<ul class="menu">
<li><a href="#" class ="Part 1"><xsl:value-of select="//foo:Heading[1]"/> </a></li>
<li><a href="#" class ="Part 2"><xsl:value-of select="//foo:Heading[2]"/></a></li>
</ul>
<div id="heading">
<xsl:for-each select="//foo:Entry">
<!--<xsl:sort select="Heading"/> -->
<div class ="topNavigation"><a href="#home"><h3><xsl:value-of select="foo:Heading"/></h3></a></div>
</xsl:for-each>
<div class ="panes">
</div>
</div>
<div id ="blogpicture">
<div class="picture">
<div id="headerTitle"><h2><xsl:value-of select="//foo:Title"/></h2></div>
</div>
</div>
</body>
</html>
</xsl:template>
</xsl:transform>
メニューを取得しようとしていますが、現在取得しているのはメニューのパート 1 だけです。for ループではパート 2 を取得できます。代わりに、ループの使用に固執することもできます。ループ中 (クラス ID をインクリメント) My blog
<Entry>
<Heading id="101">Part 1</Heading>
<body>
<text>something interesting</text>
<pictures>pictures in the body</pictures>
<videos>Videos in the body</videos>
</body>
<labels>Seperate labels with commas</labels>
<date> 20121119</date>
<location>The location the blog was published</location>
</Entry>
<Entry>
<Heading id="102">Part 2</Heading>
<body>
<text>something</text>
<pictures>pictures in the body</pictures>
<videos>Videos in the body</videos>
</body>
<labels>Seperate labels with commas</labels>
<date> 2012-11-26Z</date>
<location>The location the blog was published</location>
</Entry>
<author>me</author>
これが、現在メニュー u に表示されている出力がパート 1 であり、パート 2 が必要な場所の "" であることに何らかの意味があることを願っています。ただし、xsl の for each ループは、パート 1 と 2 の見出しをもたらします。