harmmeijer
Programmer
This is the xml page:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='test.xsl'?>
<root>
<software>
<name>software1</name>
</software>
<software>
<name>software2</name>
</software>
<software>
<name>software3</name>
</software>
</root>
This is the xsl page:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="
<xsl:template match="root/software" mode="grp-grp">
current software: <xsl:value-of select="name" />
preceding software: <xsl:value-of select="preceding::software/name" /><br></br>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="root/software" mode="grp-grp"/>
</xsl:template>
</xsl:stylesheet>
This is what I see when I open the xml page in IE5:
current software: software1 preceding software:
current software: software2 preceding software: software1
current software: software3 preceding software: software1
I think I understand the first two lines but why is preceding::software/name still software1 the third time (or the hundreth time for that matter)?
What is the use of preceding?
How can I get the previous value of software?
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='test.xsl'?>
<root>
<software>
<name>software1</name>
</software>
<software>
<name>software2</name>
</software>
<software>
<name>software3</name>
</software>
</root>
This is the xsl page:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="
<xsl:template match="root/software" mode="grp-grp">
current software: <xsl:value-of select="name" />
preceding software: <xsl:value-of select="preceding::software/name" /><br></br>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates select="root/software" mode="grp-grp"/>
</xsl:template>
</xsl:stylesheet>
This is what I see when I open the xml page in IE5:
current software: software1 preceding software:
current software: software2 preceding software: software1
current software: software3 preceding software: software1
I think I understand the first two lines but why is preceding::software/name still software1 the third time (or the hundreth time for that matter)?
What is the use of preceding?
How can I get the previous value of software?