Solved

How to store each node or attribute in XSLT?

Posted on 2011-02-28
3
326 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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 …
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. 
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

734 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