• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

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
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic