Subject: Q on <xsl:templates>
From: "Walter Torres" <walter@xxxxxxxxx>
Date: Wed, 31 Jan 2001 13:19:58 -0600
|
I am reading Michael Kays Book (XSLT Pro Ref) and learning alot!
On page 71 there is a demo stylesheet that shows how to create an HTML Table
for the books.xml on page 70.
My question is this... from what I see, it looks like the order of cell
display is determined by the data order.
I understand that if I explicitly define each cell/NODE I can determine what
order this data is to be displayed, but this defeats the nice recursion
going on here (ie: page 73).
What I am trying to do is create a method that inwhich another XML structure
can determine the display order of this books.xml.
For example, I create a <titles> block (see below) that I want to use to
determine the display order on the fly. So if I want to change this order, I
simply change this <titles> blcok and not the XSLT code.
( I added <pubdate> to the books.xml data )
I have read chatper 8:Design Patterns, but I saw nothing I could derive a
solution to fit what I am looking for.
can someone show my a few pointer, sources, urls, pages numbers on how I
might go about solving this?
Thanks
Walter
============================
This block should do 3 things:
1) determine the NODE display order
2) Be used as column titles in the table display
3) Set the column width for its respective cell
<books>
<titles>
<header id='title' colWidth='180'>Title</header>
<header id='author' colWidth='080'>Author</header>
<header id='price' colWidth='050'>Price</header>
<header id='pubdate' colWidth='*' >Published</header>
<header id='pages' colWidth='040'>Pages</header>
<header id='binding' colWidth='120'>Binding</header>
</titles>
... original data goes here...
</books>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|