Why doesn't this XPath query work as I assumed?
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 3
- Joined: Wed May 28, 2025 10:38 am
Why doesn't this XPath query work as I assumed?
Post by teresarich »
Hello,
I have the following query (XPath 2.0):
I'm looking to find topic and xref elements that have a hash in their href attribute while excluding certain types of elements. The issue is that the query above doesn't show elements with @outputclass='expandable'.
I had to run a separate query to identify those elements:
Why doesn't the first, longer query display those elements? I also tried using contains(@class, '- topic/xref') instead of @class='- topic/xref', but it didn't make a difference.
I have the following query (XPath 2.0):
Code: Select all
//xref[contains(@href,'#') and @class='- topic/xref ' and @type!='step' and @type!='fig' and @type!='substep']
I had to run a separate query to identify those elements:
Code: Select all
//xref[contains(@href,'#') and @outputclass='expandable']
-
- Posts: 9523
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Why doesn't this XPath query work as I assumed?
Hi,
There is answer by Michael Kay, the person who develops the Saxon XSLT processor here:
https://stackoverflow.com/questions/105 ... xslt-xslif
So in our case "@type!='step'" is not true because @type does not exist as an attribute on the element. But this works "not(@type='step')".
Regards,
Radu
There is answer by Michael Kay, the person who develops the Saxon XSLT processor here:
https://stackoverflow.com/questions/105 ... xslt-xslif
Code: Select all
not(A = "NA") returns true if A is either absent, or has a value not equal to "NA". By contrast, A != "NA" returns true if A is present and not equal to "NA"
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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