Re: How Can I Reference previous XML in Subsequent It
Hmm, most people have a problem getting rid of there procedural thinking when switching to a more declarative or functional style of a language. The concepts are fundamentally different: in OO/Procedural, the programmer writes down step by step what the computer should do (i.e., the programmer must do a lot of thinking to get the computer do what he wants), and in Declarative programming, the programmer just tells the computer what results he wants, and the computer does all the thinking.
However, the literature and online docs seem to be astoundingly chaotic. I always get dozens of Google hits when I make a query, and very few of them actually answer my question. I've never seen anything like this before.
Well, I feel the same when looking for something in the C++ world (biggest problem: the '++' in the word), where I usually get too much information. But after a while, you'll feel more comfortable and you'll start using the right queries. I often use Google with "XSLT faq" and then the keywords. The answers are mostly in the first few hits.
About the literature: I found the XSLT Cookbook and the XSLT Programmers Reference very valuable.
Here's the question:
There has been more discussion about XSLT + Excel on this list. You may want to check the archives.
This means that, as I iterate through an XML file,
You don't iterate though the XML file (not with XSLT that is). The processor does that for you. You only declare what the outcome should look like.
I need to yank out a @Style attribute, fetch a previous style declaration, and shoehorn that declaration into the current element's style attribute.
Well, that looks like you have some globally accessible element and you need its value when your context is around some deeper child. Seems to me something you could 'shoehorn' with xsl:key, or a simple /path/to/style lookup.
So, why do I need an expert opinion?
You don't need to. You persist the results to disk or elsewhere. That's all.
"Variables" are about as close as it comes, and I might be able to do it with them, but they are very, very stiff, primitive and awkward.
Hmm. When I first started out with XSLT my first question was similar: how can I assign to a variable? Etc. But what XSLT calls variables has *very little* to do with what you call a variable in a C++ or similar procedural language. And they are a magnitude more powerful.
In any case, I may not have a choice,
Plenty of choices around ;)
I am using php:functionString callouts,
You should not be needing them for the problem you describe.
Plenty, but we need a little more info. Can you provide us with a smallest-possible example that illustrates your problem? Provide input XML and your expected output XML and how they relate to one another (please subscribe to the list, instead of digest while in the discussion)
Cheers, -- Abel Braaksma
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format