I have an xml document like the one below:
<room name='Green'>
<equipmentList>
</equipmentList>
</room>
<room name='White'>
<equipmentList>
<equipment>Projector</equipment>
<equipment>PC</equipment>
<equipment>Mac</equipment>
</equipmentList>
</room>
<room name='Blue'>
<equipmentList>
<equipment>Projector</equipment>
<equipment>PC</equipment>
</equipmentList>
</room>
I am trying to output all of the equipment in each room. If I use the following:
<xsl:template match="rooms">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="room">
<p>
<b><u><xsl:value-of select="@name"/></u></b>
<xsl:text> </xsl:text>
<xsl:for-each select="equipmentList">
<xsl:value-of select="equipment"/>
</xsl:for-each>
</p>
</xsl:template>
</xsl:stylesheet>
I can get the list of rooms just fine but it will only list projector for each room when there is more equipment. When I just use value-of select equipmentList, I get a list of all the equipment in each room, but it is run together like this
ProjectorPCMac
How can I get it to list each piece of equipment so that is is not all run together?
<room name='Green'>
<equipmentList>
</equipmentList>
</room>
<room name='White'>
<equipmentList>
<equipment>Projector</equipment>
<equipment>PC</equipment>
<equipment>Mac</equipment>
</equipmentList>
</room>
<room name='Blue'>
<equipmentList>
<equipment>Projector</equipment>
<equipment>PC</equipment>
</equipmentList>
</room>
I am trying to output all of the equipment in each room. If I use the following:
<xsl:template match="rooms">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="room">
<p>
<b><u><xsl:value-of select="@name"/></u></b>
<xsl:text> </xsl:text>
<xsl:for-each select="equipmentList">
<xsl:value-of select="equipment"/>
</xsl:for-each>
</p>
</xsl:template>
</xsl:stylesheet>
I can get the list of rooms just fine but it will only list projector for each room when there is more equipment. When I just use value-of select equipmentList, I get a list of all the equipment in each room, but it is run together like this
ProjectorPCMac
How can I get it to list each piece of equipment so that is is not all run together?