Solved

How to store each node or attribute in XSLT?

Posted on 2011-02-28
3
324 Views
Last Modified: 2012-05-11
Hi,
I have to write an XSLT which has to read almost all nodes and attribute. more than one time.
and has to write is there any concept of stack or storage that stores the nodes or attributes to write them after words?

0
Comment
Question by:SANbuddies
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 50 total points
ID: 34998469
Nope, there is not (unless you would do multiple passes)
Variables don't vary in XSLT,
but that usually is not a problem,
since you can process the source tree as many times as you need to and you always have full XPath access to the full tree

Instead of creating a stack with information, just write some XPath that process the tree to give you exact info when you need it
0
 

Author Comment

by:SANbuddies
ID: 34998490
yes but processing is simple but writing is difficult if you are not copying the tree.
Traversing twice same tree will consume more resources.
and XPATH is only good when you know the XML but if its varying then you need to have a foreach loop.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 34998553
Well, it all depends,
- instead of for-each use apply-templates, you will find that it works a lot more flexible (so writing becomes Not difficult),
 and the major memory consumption usually is in creating the tree, after that most sensible operations are fairly cheap
- you don't need to know the XML for XPath, there are patterns and wild cards (so I don't agree with your clsoing sentence)

Anyway, you asked a very general question which I answered as much as possible given the question detail

If you need more detail, I think you need to be more precise
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XSL - change date format 3 49
ASP.NET reading ATOM 2 68
Fulfillment API php code sample 1 58
Xslt: how to use use for each to loop through four iterations only 4 25
The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question