• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

XPATH for IDREFS in XSL?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could anyone please explain to me how to create an XPATH expression to retrieve data that relates to a specific ID within an IDREFS string.
I would like to retrieve the data within the 'description' tags for each 'event' whose id's are referenced in the '@events' within the 'requirement' element.

Could anyone please explain this using the below information?
Thanks,
Tristan

DTD:
<!ELEMENT requirement (#PCDATA)>
<!ATTLIST requirement number ID #REQUIRED
events IDREFS #REQUIRED>
XML:
<requirement id="req1" events="ev1 ev2">All solutions to existing problems must be authorized by the technical director</requirement>
<event id="ev1">
<description>creating a solution</description>
</event>
<event id="ev2">
<description>implementing solution</description>
</event>
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tristan,
First you need to update your DTD to specify that the id attribute of an event is of type ID. Then you can use the id() function as specified by XPATH.
For instance:
events.dtd
events.xml
events.xsl
will produce
Hope this helps.
Cheers,
Beno�t
[This message has been edited by Beno�t d'Oncieu (edited September 04, 2001).]
 
Tristan Taylor
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a Lot Beno�t,
You've made my life a lot easier.
Cheers,
Tristan
 
Whose rules are you playing by? This tiny ad doesn't respect those rules:
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