[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Beyond XSL's capabilities?

Subject: Beyond XSL's capabilities?
From: "Blanchette, Larry" <Larry.Blanchette@xxxxxxxxxxxxx>
Date: Tue, 16 Mar 1999 13:55:20 -0600

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>

<xsl:template match="menu.group">
	<p><xsl:value-of select="@..."/></p>
<!-- how to generate the groups's list ?
	this doesn't work id's need to be unique
	<xsl:apply-templates select="id(@...)"/>

	looked at the following but not valid:
	<xsl:apply-templates select=
	  "[/drink.menu/beverage.list/beverage@xxxxxxxx = @...]"/>

	<xsl:for-each select="/drink.menu/beverage.list/beverage">
	  in the context of beverage here so i've lost menu.group@xxxxxxxx ?

Sample data:

<?xml version="1.0"?>

        <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>
        <menu.group bev.type='Vodka'/>
        <menu.group bev.type='Beer' />

Larry Blanchette

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread