How Can I Reference previous XML in Subsequent Iterat
Folks, First of all, it's great to see some ongoing discussion of XSLT. I've found it very, very difficult to get meaningful help as I come up to speed in XSLT. I have twenty-some years of C++ experience, and ten years of Web design, so I'm not having too much difficulty getting the concepts down. 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. Someone suggested that I post a question I asked in another forum here. The question is collecting dust on the other forum, but I hope that I can get an answer here. Here's the question: I'm starting a pretty ambitious XSLT project. I'm transforming Microsoft Excel XML files into inline XHTML for display on a wiki. If anyone has seen the Excel schemas, they know that this is not a project for the faint of heart. In any case, a pretty universal Microsoft schema structure is to have a whole bunch of styles up front, and then reference those styles in attributes throughout the document. The way that most people would render this would be to stick the styles into the <head>, and reference them through class attributes in the body. Simple, no? No. As I mentioned, I'm transforming these **inline**, so that means that I need to make the styles actual "style" attributes, not class references. I may have three different spreadsheets on one Wiki page; each, with its own view of how a number should be formatted. This means that, as I iterate through an XML file, I need to yank out a @Style attribute, fetch a previous style declaration, and shoehorn that declaration into the current element's style attribute. So, why do I need an expert opinion? It seems, from my previous research, that there is no way for XSLT to store persistent information. "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. In any case, I may not have a choice, but I wanted to ask if anyone has any ideas on this issue. I have had incidents in the past, where I was trying to solve a problem with a spanner, and someone pointed out that a screwdriver would address the issue better. My XML version is 1.0 My XSLT Version is 1.0, as is my XPath version. I am using the PHP 5 XSLTProcessor implementation (libxslt), and <oXygen/> as my workshop. I am using php:functionString callouts, and can probably use them for this, but I wanted to find out if I just have it all wrong, and there is a "pure" XSLT way of dealing with this. The problem with using PHP callouts is that I can't run the transform in <oXygen/>, which makes debugging a bit more difficult. Any ideas? Thanks in advance. META: I am subscribed as a digest, so I won't be reading responses for some time. Feel free to use the email addy in my .sig to contact me directly if you want my immediate attention. Chris Marshall chris at getridofthiswholelongthingybecauseitstoconfusescrapers littlegreenviper dot com http://www.cmarshall.net/
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