|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Beyond XSL's capabilities?
I've been unable to reach a solution for the following example where I would
like to group a set of elements based on an attribute value, this would be
driven by a different element's attribute value.
My conclusion is you can't get there with xsl and the only recourse is to
rework the schema. Is this correct?
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:id element="beverage" attribute="bev.type"/>
<xsl:template match="drink.menu">
<html><title>Drink Menu</title>
<body><xsl:apply-templates select="menu"/></body>
</html>
</xsl:template>
<xsl:template match="menu.group">
<p><xsl:value-of select="@bev.type"/></p>
<p>
<!-- how to generate the groups's list ?
this doesn't work id's need to be unique
<xsl:apply-templates select="id(@bev.type)"/>
looked at the following but not valid:
<xsl:apply-templates select=
"[/drink.menu/beverage.list/beverage@xxxxxxxx = @bev.type]"/>
<xsl:for-each select="/drink.menu/beverage.list/beverage">
in the context of beverage here so i've lost menu.group@xxxxxxxx ?
-->
</p>
</xsl:template>
</xsl:stylesheet>
Sample data:
<?xml version="1.0"?>
<drink.menu>
<beverage.list>
<beverage bev.type='Beer'>Sierra Nevada</beverage>
<beverage bev.type='Beer'>Newcastle</beverage>
<beverage bev.type='Vodka'>Screwdriver</beverage>
<beverage bev.type='Vodka'>Greyhound</beverage>
</beverage.list>
<menu>
<menu.group bev.type='Vodka'/>
<menu.group bev.type='Beer' />
</menu>
</drink.menu>
Thanks
Larry Blanchette
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








