S
Steven An
I'm gonna describe the situation I'm dealing with..but if you're not
interested, just skip to the last line where I bluntly ask my question
Here's my scenario: I've got a huge website that has many pages.
Each page has its own content (which changes often). So I wanna use
XSLT stylesheets to create these pages (so I can modify the appearance
of the whole site easily). So that's pretty straightforward: one XML
file per page, with a common stylesheet for them all.
However, each page also has a navigation menu. This menu should look
the same for all pages. You may think..just put the navigation menu
in the page stylesheet! But..what if I want to use XSLT to create
this menu as well? Because say I have a LOT of items in this menu and
they all need to have a common style (that I want to be easily
modifiable).
One solution is that I could put the menu data in with each page XML,
and thus have the page stylesheet create the menus and the page..but
this seems wasteful for many reasons. So here's the solution I'd like
to use: I have a stylsheet which takes in the menu XML and then
outputs ANOTHER stylesheet that transforms my page data. So the
latter stylesheet would have all the generated menu HTML in it
already.
The question: How do I have a stylesheet output a stylesheet (based on
XML input)? I've tried using CDATA, but that's really messy and
doesn't quite work (I get a lot of & gt;'s and what not). Or is there
a better way to deal with my situation (which I'm sure is not
uncommon)?
Any advice would be appreciated,
Steve
interested, just skip to the last line where I bluntly ask my question
Here's my scenario: I've got a huge website that has many pages.
Each page has its own content (which changes often). So I wanna use
XSLT stylesheets to create these pages (so I can modify the appearance
of the whole site easily). So that's pretty straightforward: one XML
file per page, with a common stylesheet for them all.
However, each page also has a navigation menu. This menu should look
the same for all pages. You may think..just put the navigation menu
in the page stylesheet! But..what if I want to use XSLT to create
this menu as well? Because say I have a LOT of items in this menu and
they all need to have a common style (that I want to be easily
modifiable).
One solution is that I could put the menu data in with each page XML,
and thus have the page stylesheet create the menus and the page..but
this seems wasteful for many reasons. So here's the solution I'd like
to use: I have a stylsheet which takes in the menu XML and then
outputs ANOTHER stylesheet that transforms my page data. So the
latter stylesheet would have all the generated menu HTML in it
already.
The question: How do I have a stylesheet output a stylesheet (based on
XML input)? I've tried using CDATA, but that's really messy and
doesn't quite work (I get a lot of & gt;'s and what not). Or is there
a better way to deal with my situation (which I'm sure is not
uncommon)?
Any advice would be appreciated,
Steve