This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]