xPath query attributes in a list
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 5
- Joined: Tue Feb 18, 2020 5:29 pm
xPath query attributes in a list
Hello, How would I get the @text attribute for each <ListItem> in the below?
I can use the following xPath query to get as far as concatenating the title, defaultfieldname and type. If the type = list then it has child elements I need to include.
Code: Select all
<Controls>
<Control id="108" defaultfieldname="purpose" controltype="Control1x2" styleid="0" readonly="False" required="False" skiponedit="False">
<Labels title="Purpose" description="purpose" />
<Input type="List" allowdecimals="False" formvalueproviderid="0">
<List serviceid="0" layerindex="0" fieldname="" multiselect="False">
<ListItems>
<ListItem text="Routine" value="Routine" />
<ListItem text="Dead End" value="Dead End" />
<ListItem text="Disinfection" value="Disinfection" />
<ListItem text="Water Quality" value="Water Quality" />
<ListItem text="System" value="System" />
</ListItems>
</List>
</Input>
<Value text="" textformatid="0" valueformatid="0" codedvaluedisplay="Name" />
<Targets />
<Dependencies />
<Validations />
</Control>
Code: Select all
string-join(//AssetLayers/AssetLayer/Forms//Control/(concat(Labels/@title, ',',@defaultfieldname,',', Input/@type,List)), " ")
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: xPath query attributes in a list
Hi,
In the context of Control, instead of "Input/@type,List", use:
Regards,
Adrian
In the context of Control, instead of "Input/@type,List", use:
Code: Select all
Input[@type='List']/List/ListItems//ListItem/@text
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: xPath query attributes in a list
Hi,
Not sure what's the desired output. Comma separated?
You can use string-join() around the XPath that returns the sequence.
e.g.
Regards,
Adrian
Not sure what's the desired output. Comma separated?
You can use string-join() around the XPath that returns the sequence.
e.g.
Code: Select all
string-join(//Control/(concat(Labels/@title, ',' ,@defaultfieldname, ',' , Input/@type, ',' ,string-join(Input[@type='List']/List/ListItems//ListItem/@text, ','))), " ")
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service