Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 

Go Back   XSL - XML - RSS Forums > XSLForum: Main > XSL-XSD-XML and more

Tags:



Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-11-2008, 12:46 PM
Martin Honnen
 
Posts: n/a

Default Re: Xpath and axis navigation using libxml



Alfie Noakes wrote:

> My question is, what is the best way to step through all the field
> elements in each row? I can do it in the software stepping through the
> sibling and child nodes but these seems cumbersome. I suspect there's
> something I can do using axis. Am I right?



Are you using XSLT? Then you can do
<xsl:for-each select="//table[@name='animals']/row">
<xsl:for-each select="field">
...
</xsl:for-each>
</xsl:for-each>


--

Martin Honnen
http://JavaScript.FAQTs.com/
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-11-2008, 02:06 PM
Martin Honnen
 
Posts: n/a

Default Re: Xpath and axis navigation using libxml

Alfie Noakes wrote:
> There's no XSLT being used, though I have an XSD to validate against
> when the XML is loaded by the libxml library.


Well even if you don't use XSLT as the host language for your XPath
expressions the expressions below are still what you need

>> <xsl:for-each select="//table[@name='animals']/row">
>> <xsl:for-each select="field">


meaning you first use //table[@name='animals']/row, the for each row
element in that node set you evaluate the relative XPath expression
field
with the row element as the context node. I don't know the libxml API so
I can't help with a concrete code sample.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Contact Us -|- XSL - XML - RSS Forums -|- Archive -|- Top -|-Rules/Disclaimer-|-Help/Support -|-Advertise
© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
All times are GMT. The time now is 12:32 PM.
Style Developed by Epic Designz