Ik ben sinds gisteren bezig met xml en xslt, xml in de vorm van rss. Mijn vraag: kan ik doormiddel van xslt een vorige/volgende knop aanmaken als de aantal nodes(feeds) boven de 5 zijn. En hoe? Ik heb w3schools geraadpleegd voordat ik hiermee begon, maar ik kon niet echt iets bruikbaars vinden. Google heeft me ook niet echt veel opgeleverd.


<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="testrss.xsl"?>
<rss version="2.0">

<channel>
<item>
  <title>W3Schools Home Page</title>
  <link>http://www.w3schools.com</link>
  <description>Free web building tutorials</description>
  </item>
  <item>
    <title>RSS Tutorial</title>
    <link>http://www.w3schools.com/rss</link>
    <description>New RSS tutorial on W3Schools</description>
  </item>
  <item>
    <title>XML Tutorial</title>
    <link>http://www.w3schools.com/xml</link>
    <description>New XML tutorial on W3Schools</description>
  </item>
  <item>
    <title>CSS Tutorial</title>
    <link>http://www.w3schools.com/css</link>
    <description>New CSS tutorial on W3Schools</description>
  </item>
  <item>
    <title>JS Tutorial</title>
    <link>http://www.w3schools.com/js</link>
    <description>New JavaScript tutorial on W3Schools</description>
  </item>
  <item>
    <title>Some Tutorial</title>
    <link>http://www.w3schools.com/</link>
    <description>New Something tutorial on W3Schools</description>
  </item>
  <item>
    <title>Some 1 Tutorial</title>
    <link>http://www.w3schools.com/</link>
    <description>New Something 1 tutorial on W3Schools</description>
  </item>
  <item>
    <title>Some 2 Tutorial</title>
    <link>http://www.w3schools.com/</link>
    <description>New Something 2 tutorial on W3Schools</description>
  </item>
  <item>
    <title>Some 3 Tutorial</title>
    <link>http://www.w3schools.com/</link>
    <description>New Something 3 tutorial on W3Schools</description>
  </item>
  <item>
    <title>Some 4 Tutorial</title>
    <link>http://www.w3schools.com/</link>
    <description>New Something 4 tutorial on W3Schools</description>
  </item>
  <item>
    <title>Some 6 Tutorial</title>
    <link>http://www.w3schools.com/</link>
    <description>New Something 6 tutorial on W3Schools</description>
  </item>
  <item>
    <title>Some 7 Tutorial</title>
    <link>http://www.w3schools.com/</link>
    <description>New Something 7 tutorial on W3Schools</description>
  </item>
  <item>
    <title>Some 8 Tutorial</title>
    <link>http://www.w3schools.com/</link>
    <description>New Something 8 tutorial on W3Schools</description>
  </item>
  <item>
    <title>Some 9 Tutorial</title>
    <link>http://www.w3schools.com/</link>
    <description>New Something 9 tutorial on W3Schools</description>
  </item>
  <item>
    <title>Some 10 Tutorial</title>
    <link>http://www.w3schools.com/</link>
    <description>New Something 10 tutorial on W3Schools</description>
  </item>
</channel>

</rss>



<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <head>
  <title></title>
  </head>
  <body>
  <xsl:for-each select="rss/channel/item">
  <a>
	<xsl:attribute name="href">
		<xsl:value-of select="link" />
	</xsl:attribute>
	
	<xsl:value-of select="title" />
  </a>
  <br />
   <xsl:value-of select="description" />
   <br />
   <br />
   </xsl:for-each>
   
   <a>
   <xsl:number value="count(rss/channel/item)"/>

   </a>

  </body>
  </html>
</xsl:template>
</xsl:stylesheet>


edit--
Ik d8 misschien zo iets?!
<xsl:variable name="count">
<xsl:number value="count(rss/channel/item)"/>
</xsl:variable >
<xsl:if test="$count &gt; 5">
show
</xsl:if>



edit2--
Ik heb iets gevonden: http://www.biglist.com/lists/xsl-list/archives/200101/msg00114.html

Maar het is mij nog onduidelijk hoe ik dit zou kunnen gebruiken?

Reageren