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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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 =)

   
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.