Re: Naming an attribute as the atribute value of a HTML tag...

Subject: Re: Naming an attribute as the atribute value of a HTML tag...
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 22 Nov 2000 00:15:35 -0700 (MST)
Rosa I-Ting Cheng wrote:
> What I want to do is have the value of the 2nd Property as the 'value' in
> the <OPTION value=''> tag.  In the browser should look something like this:
> 
> SHOWGROUNDS (SP272005)
> SHOWGROUND (SP380215)      <=== in a list box.
> 
> Here's a snippet of the  XML:
> <Entities>
> <Entity Id='PV_CAP36066995170023' Class='Substations' Name='SP272005'>
> <Properties>
> <Property Caption='Name' Value='SHOWGROUNDS'/>
> <Property Caption='Operational Number' Value='SP272005'/>
> </Properties>
> </Entity>
> <Entity Id='PV_CAP36066995600004' Class='Substations' Name='SP380215'>
> <Properties>
> <Property Caption='Name' Value='SHOWGROUND'/>
> <Property Caption='Operational Number' Value='SP380215'/>
> </Properties>
> </Entity>
> </Entities>

I suspect you really want the value of the Property that has a certain
Caption attribute value. It happens to be the 2nd one and you could select it
just on that basis alone by replacing the [...] below with [2], but this is
probably more what you want:

  <xsl:for-each select="/Entities/Entity">
    <option value="{Properties/Property[@Caption='Operational Number']/@Value}">
      <xsl:value-of select="Properties/Property[@Caption='Name'/@Value"/>
    </option>
  </xsl:for-each>

   - Mike
____________________________________________________________________
Mike J. Brown, software engineer at         My XML/XSL resources:
webb.net in Denver, Colorado, USA           http://www.skew.org/xml/


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


Current Thread