BizTalk Utilities Xselerator XSLT IDE


Forum main page

Most active member

Login page
Register
Log out

Search page


View our event calendar
Add general event such as an upcoming software release or conference
View all birthdays

Public image gallery
Upload your images in your profile

Profile editing page
Subscription list page
Address book page

Member list page
View the most active member
User groups listing

Private message page

TopXML Discussion Forum TopXML Discussion Forum

Forums  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

apply-templates and don't come back...?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Ask XML questions here] >> XSLTalk (Programming) >> apply-templates and don't come back...? Page: [1]
Login
Message << Older Topic   Newer Topic >>
apply-templates and don't come back...? - 15 September 2008   
claes

 

Posts: 4
Score: 0
Joined: 11 February 2008
Status: offline
Hi,
I am pretty new to xslt and have a basic question.
I have a set of template rules that styles a pdf document from raw xml data. In my xml there is an element <overview> that is always at the very end of the doc before the closing </root>. In some cases I want to branch on a variable after writing some of the <head> element data at the top of the doc (with <xsl:template match="root/head/title">), and if the var has a value "x" I want to apply-templates select="../../overview" /> and write out the content of <overview> and then stop!

In my output I get the <head> content, then the <overview> content (just like I want), but... then it "jumps back" and continues with all other elements between <head> and <overview>.
Why is that? I thought after the "apply-templates select=..." it would jump to overview but not continue with the rest of the doc, since there is no other apply-templates after the jump to <overview>...

Maybe I am being unclear, any help and suggestion are welcome! I am happy to try and clarify if needed.

Thanks!!
/Claes
Post #: 1
RE: apply-templates and don't come back...? - 16 September 2008   
nickat

 

Posts: 4
Score: 0
Joined: 26 July 2008
Status: offline
quote:

ORIGINAL: claes
then it "jumps back" and continues with all other elements between <head> and <overview>.
Why is that? I thought after the "apply-templates select=..." it would jump to overview but not continue with the rest of the doc, since there is no other apply-templates after the jump to <overview>...


It always "jumps back" because the input tree is traversed recursively and all matching templates are applied to every node.

You can use modes to choose different templates based on some condition.

It's hard to give some concrete advice, since I don't have the whole picture. Some essential parts of your stylescheet, an example of an input and expected output could help.

(in reply to claes)
Post #: 2
RE: apply-templates and don't come back...? - 17 September 2008   
claes

 

Posts: 4
Score: 0
Joined: 11 February 2008
Status: offline
Thanks,
I guess I didn't understood the recursive traverse, but now I do
I read about modes and that will do the trick for me!

Thanks again!

(in reply to nickat)
Post #: 3
Page:   [1]
All Forums >> [Ask XML questions here] >> XSLTalk (Programming) >> apply-templates and don't come back...? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



Email TopXML

Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.047