473,382 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Recursive xslt expansion

Can I have one XSLT style sheet which expands some brief XML to a longer
"normalized" form, which one of several other XSLT style sheets expands
further (or one of several parts of one sheet)? Finally, I'll render it
with a CSS style sheet. Or is there some other way one normally does
that?

E.g. in this xml:

<library>
<author a_id="me" name="Myself"/>
<series s_id="mine" name="My series">
<by a_ref="me"/>
<omnibus name="Foobar">
<with>You</with>
<novel name="Foobar #1"/>
<novel name="Foobar #3" <by name="Her"/</novel>
<novel name="Foobar #2"<with name="Him"/</novel>
</omnibus>
</series>
</library>

outer <by>s are inherited if there is no other <byto use at a level,
while <withadds a new <byto the currently active <by>s. Also, not
sure if I'll implement this but here author names not directly inside
<libraryare dragged out to <libraryand given an a_id. So the above
expands to (maybe with numbered new a_ids rather than those shown here):

<library>
<author a_id="me" name="Myself"/>
<!-- Author IDs generated from authors without IDs: -->
<author a_id="id_You" name="You"/>
<author a_id="id_Her" name="Her"/>
<author a_id="id_Him" name="Him"/>
<series s_id="mine" name="My series">
<by a_ref="me"/>
<omnibus name="Foobar">
<by a_ref="me"/>
<by a_ref="id_You"/>
<novel name="Foobar #1">
<by a_ref="me"/>
<by a_ref="id_You"/>
</novel>
<novel name="Foobar #3">
<by a_ref="id_Her"/>
</novel>
<novel name="Foobar #2">
<by a_ref="me"/>
<by a_ref="id_You"/>
<by a_ref="id_Him"/>
</novel>
</omnibus>
</series>
</library>

which is then expanded further by some other sheet.

--
Hallvard
Jan 4 '07 #1
1 1632
Hallvard B Furuseth wrote:
Can I have one XSLT style sheet which expands some brief XML to a longer
"normalized" form, which one of several other XSLT style sheets expands
further (or one of several parts of one sheet)? Finally, I'll render it
with a CSS style sheet. Or is there some other way one normally does
that?
You can chain XSLT transformations as long as the stylesheets transform
to XML respectively don't depend on stuff like disable-output-escaping.
The last stylesheet in the chain can then transform to HTML.

Using one stylesheet to do several transformation passes is also
possible with XSLT 1.0 but only if the XSLT processsor supports an
extension function like exsl:node-set to transform a result tree
fragment to a node set so that each pass creates a result tree fragment,
the extension functions then creates a temporary node set on which the
next pass works.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 4 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Steve Goldman | last post by:
Hi, I am trying to come up with a way to develop all n-length permutations of a given list of values. The short function below seems to work, but I can't help thinking there's a better way. ...
5
by: Don Garrett | last post by:
I have an XML document at the root of a directory tree that contains relative URIs to resources in a directory tree. During XSLT processing, these URI's can be used without any problems to...
0
by: yurick | last post by:
Hello everybody, I have XML structure like this: <person name="adam"/> <person name="eve"/> <person name="cain"> <parent name="adam"/> <parent name="eve"/> </person>
7
by: shaun roe | last post by:
Hi, I am using an XSLT to generate an SVG client-side in Firefox. The user opens an XML file in Firefox and sees a display. In doing so, I have to convert from cartesian to polar coordinates, so...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.