473,614 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

have a stylesheet generate another stylesheet based on XML?

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
Jul 20 '05 #1
1 1652


Steven An wrote:

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)?


Use a namespace alias e.g.
<xsl:styleshe et
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:xso="http ://www.w3.org/1999/XSL/Transform/Output"
version="1.0">

<xsl:namespac e-alias stylesheet-prefix="xso"
result-prefix="xsl" />

<xsl:template match="/">
<xso:styleshe et ...>
...
<xso:stylesheet >
</xsl:template>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #2

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

Similar topics

17
8506
by: Bruce W...1 | last post by:
I don't seem to be getting anywhere with trying to make my web page transitional XHTML. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> There are many errors returned at the W3C validator but the first one has me stumped. It's my stylesheet link tag. <LINK REL="stylesheet" HREF="styles.css" type="text/css">
48
8653
by: David J Patrick | last post by:
I'm trying to rewrite the CSS used in http://s92415866.onlinehome.us/files/ScreenplayCSSv2.html. using the w3.org paged media standards as described at http://www.w3.org/TR/REC-CSS2/page.html The ScreenplayCSS is flawed, for several reasons; -overuse of <div id= tags -doesn't scale screen resolutions (convert from px to in, pt ?) -no media="print" (how much coule be shared between "screen" & "print") -no automatic page breaks (with...
7
5201
by: pintihar | last post by:
Hi, As a follow on from an earlier post I have another question about xslt. Is it possible to create the stylsheet programatically? Is this sensible? In the first phase I needed to map element name from inbound xml to my internal elements to standardize disparate input. Now I could just create an xslt stylesheet for each possible inbound format and be done, but I think it would be powerful to be able store this mapping in a database and...
2
1637
by: J055 | last post by:
Hi I'm adding rules dynamically to the HtmlHead.StyleSheet using the CreateStyleRule method. I'd like to know how to check whether the rules already exist first. Thanks Andrew
0
8142
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8287
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7114
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6093
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1438
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.