W3C home > Mailing lists > Public > www-forms@w3.org > March 2005

XPath nodeset filtering by a constant element name defined in another expression (value of XPath)

From: Mike Kienenberger <mkienenb@alaska.net>
Date: Thu, 10 Mar 2005 22:48:42 -0500
To: www-forms@w3.org
Message-ID: <0503102248.AA427343@pavilion>

I have xml data of this form:

<SubstationDistributionWorkType>

 <AllowedWorkType>

  <Description>Annunciator</Description>

  <ARS>false</ARS>

  <BRS>true</BRS>

  <BKS>true</BKS>

  <CPS>true</CPS>

 [...]
 </AllowedWorkType>
</SubstationDistributionWorkType>

I want to create a select1 control showing descriptions based on whether the 
3-letter elements match another expression.

For example, the following works, but has "BKS" hardcoded in.

 			<xforms:select1 ref="WorkType"

			    appearance="minimal" class="ctrl select1" navindex="8">

			    <xforms:itemset 
nodeset="instance('scratchpad-locations-work-type')/SubstationDistributionWorkType/AllowedWorkType[BKS='true']">


			      <xforms:label ref="Description"/>

			      <xforms:value ref="Description"/>

			    </xforms:itemset>

			</xforms:select1>


However, instead of a constant element name of "BKS", I want to use the 
value from the expression "instance('work_order')/Location/SubstationCode" 
as the basis of the element name used as the filter.

I'm fairly certain that it's a matter of rewriting the filtering rather than 
simple substitution, but I'm not sure where to go from here.

I've done similar things when I needed to compare a value (rather than an 
element name) using this expression

<xforms:itemset 
nodeset="instance('scratchpad-equipment')/SubstationEquipment/Location[LocationID=instance('work_order')/Location/SubstationCode]">



but I can't seem to figure out the equivalent.

Thanks,

-Mike
Received on Friday, 11 March 2005 06:42:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:00 GMT