hallo allemaal, ik heb het volgende probleem:
(stel je hebt het volgende in XML)
<prodigy>
<album>
<titel>experience</titel>
<cijfer>9</cijfer>
</album>
<album>
<titel>music for the gilted generation</titel>
<cijfer>8</cijfer>
</album>
<album>
<titel>the fat of the land</titel>
<cijfer>7</cijfer>
</album>
</prodigy>
(op een vrij eenvoudige wijze uit te lezen met XSL for-each)
<TABLE BORDER="2">
<TR bgcolor="#9acd32">
<TD>*</TD>
<TD>titel</TD>
<TD>cijfer</TD>
</TR>
<xsl:for-each select="prodigy/album">
<TR>
<TD>
*
</TD>
<TD>
<xsl:value-of select="titel"/>
</TD>
<TD>
<xsl:value-of select="cijfer"/>
</TD>
</TR>
</xsl:for-each>
</TABLE>
(maar hoe is de <xsl:value-of select="?????"/> opgebouwd als de XML alsvolgt is)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="tweakers.xsl"?>
<page_root xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:cinclude="http://apache.org/cocoon/include/1.0">
<result xmlns:t="blabla">
<prodigy>
<album>
<t:field id="titel">experience</t:field>
<t:field id="cijfer">9</t:field>
</album>
<album>
<t:field id="titel">music for the gilted generation</t:field>
<t:field id="cijfer">8</t:field>
</album>
<album>
<t:field id="titel">the fat of the land</t:field>
<t:field id="cijfer">7</t:field>
</album>
</prodigy>
</result>
</page_root>
(met onderstaande XSL krijg ik 2 x de titel ipv titel, cijfer)
<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:t="blabla" >
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2">
<TR bgcolor="#9acd32">
<TD>*</TD>
<TD>titel</TD>
<TD>cijfer</TD>
</TR>
<xsl:for-each select="page_root/result/prodigy/album">
<TR>
<TD>
*
</TD>
<TD>
<xsl:value-of select="t:field"/>
</TD>
<TD>
<xsl:value-of select="t:field"/>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
(Hoe kan ik de titel en het cijfer op deze manier goed uitlezen ?)
(stel je hebt het volgende in XML)
<prodigy>
<album>
<titel>experience</titel>
<cijfer>9</cijfer>
</album>
<album>
<titel>music for the gilted generation</titel>
<cijfer>8</cijfer>
</album>
<album>
<titel>the fat of the land</titel>
<cijfer>7</cijfer>
</album>
</prodigy>
(op een vrij eenvoudige wijze uit te lezen met XSL for-each)
<TABLE BORDER="2">
<TR bgcolor="#9acd32">
<TD>*</TD>
<TD>titel</TD>
<TD>cijfer</TD>
</TR>
<xsl:for-each select="prodigy/album">
<TR>
<TD>
*
</TD>
<TD>
<xsl:value-of select="titel"/>
</TD>
<TD>
<xsl:value-of select="cijfer"/>
</TD>
</TR>
</xsl:for-each>
</TABLE>
(maar hoe is de <xsl:value-of select="?????"/> opgebouwd als de XML alsvolgt is)
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="tweakers.xsl"?>
<page_root xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:cinclude="http://apache.org/cocoon/include/1.0">
<result xmlns:t="blabla">
<prodigy>
<album>
<t:field id="titel">experience</t:field>
<t:field id="cijfer">9</t:field>
</album>
<album>
<t:field id="titel">music for the gilted generation</t:field>
<t:field id="cijfer">8</t:field>
</album>
<album>
<t:field id="titel">the fat of the land</t:field>
<t:field id="cijfer">7</t:field>
</album>
</prodigy>
</result>
</page_root>
(met onderstaande XSL krijg ik 2 x de titel ipv titel, cijfer)
<xsl:stylesheet version = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:t="blabla" >
<xsl:template match="/">
<HTML>
<BODY>
<TABLE BORDER="2">
<TR bgcolor="#9acd32">
<TD>*</TD>
<TD>titel</TD>
<TD>cijfer</TD>
</TR>
<xsl:for-each select="page_root/result/prodigy/album">
<TR>
<TD>
*
</TD>
<TD>
<xsl:value-of select="t:field"/>
</TD>
<TD>
<xsl:value-of select="t:field"/>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
</xsl:stylesheet>
(Hoe kan ik de titel en het cijfer op deze manier goed uitlezen ?)