• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Xpath expression

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,
Can you please help me with an xsl:if test xpath expression that tests for the occurence of the following xml. The DTD is provided.
What I need to test for is that within topic the first thing after title is sub.topic, and within that sub.topic the first thing after title is para.module, and within that para.module the first thing is activity.reading.

XML:
<topic>
<title>Planning and Research</title>
<sub.topic>
<title>Task Analysis</title>
<para.module>
<activity.reading>Read pages 45-47.</activity.reading>
</para.module>
</sub.topic>
</topic>
DTD:
<!ELEMENT topic (title, para.module*, sub.topic*)>
<!ELEMENT sub.topic (title, para.module*, idea*)>
<!ELEMENT para.module (#PCDATA | activity.reading)>

Thanks in advance to the kind soul who helps me solve this dilemma.
 
Ranch Hand
Posts: 782
Python Chrome Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well firstly you're trying to select a para.module that must
satisfy two conditions:
a) Its immediate sibling is "title".
b) Its immediate child is "activity.reading"
The following xpath expression satisfy (a) but not (b).
Maybe someone else can chip in ?

Pho
 
yeah, but ... what would PIE do? Especially concerning this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic