XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Matt MagsSubject: Rookie Question
Author: Matt Mags
Date: 11 Jul 2007 02:23 PM
Ok I need to write a template that effectively walks a tree in stages.
I need to be able to give it a root node and say "do X to children 0 to 6." I also need to be able to tell it "do Y to children 8 to 12"

I'm brand new to XSLT so this is really throwing me.

I have an XML story structure with "parag" sub-elements that make up a story to be posted online.

I.E.

Story
|
parag, parag, parag

So the goal here is to have some parags on the same page but others on different pages. The XML sadly doesn't say this explicitly, instead it says parags 0-6 go on page 1, etc etc.

Can anyone give me a clue to how to approach this problem? Thanks

Postnext
Tony LavinioSubject: Rookie Question
Author: Tony Lavinio
Date: 12 Jul 2007 12:29 AM
you want to select="element[position() <= 6]"
or select="element[position() > 6 and position() <= 8]"

Postnext
Matt MagsSubject: Rookie Question
Author: Matt Mags
Date: 12 Jul 2007 01:34 PM
Thanks that helped a lot.
One more question:
Any idea how to do that with preceeding-sibling?

I'm using

select = "preceding-sibling::page"

to get an element from the previous sibling but I just want the immediate previous sibling not all of them which is what that line seems to provide.

I know that position() returns the "index" of my current node but how can I use that to compare where I am right now to my nearest previous sibling?
Thank you

Postnext
James DurningSubject: Rookie Question
Author: James Durning
Date: 12 Jul 2007 01:40 PM
preceding-sibling::page[1] gives the immediately preceding page node.
the value of position() changes when you use an axis

Posttop
Matt MagsSubject: Rookie Question
Author: Matt Mags
Date: 12 Jul 2007 02:13 PM
Thanks that worked great =)

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.