Solved

How to store each node or attribute in XSLT?

Posted on 2011-02-28
3
323 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get last 10 digits of an xsl value-of field 7 59
Detect file exist or not 3 156
Xsl-fo show PDF when no results are returned 2 18
SQL Result Set to XML 4 36
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…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

772 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