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

Hi,

Have you tried the following? I have done some similar things with the
samples within XFormation "Dynamiclists.xhtml". 

I think your XPath should be something like this

 <xforms:itemset 
nodeset="instance('scratchpad-locations-work-type')/SubstationDistributionWo
rkType/AllowedWorkType/*[name() =
instance('work_order')/Location/SubstationCode][text() = 'true']">

Regards

Rhydian Morris

-----Original Message-----
From: Mike Kienenberger [mailto:mkienenb@alaska.net]
Sent: 11 March 2005 06:43
To: www-forms@w3.org
Subject: XPath nodeset filtering by a constant element name defined in
another expression (value of XPath)



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')/SubstationDistributionWo
rkType/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[Locat
ionID=instance('work_order')/Location/SubstationCode]">



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

Thanks,

-Mike

Received on Friday, 11 March 2005 10:50:44 UTC