473,396 Members | 2,059 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,396 software developers and data experts.

stylesheet declaration location


I have built several simple XML/XSL reports and so far have put the
declaration of the style sheet (xsl) in the header of the XML file. e.g.

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="mystylesheet.xsl" type="text/xsl"?>

That works fine.

However, I would now like to generate a number of XML files and not
include the XSL file declaration in the header. Instead, I would like
to have an HTML 'index' offering a number of options that can be applied
to particular XML files. For example options might be opening
particular XML files either in 'detail', 'overview' or 'graphic' (SVG
chart) mode.

I'm sure that this must be possible and so am hoping that someone can
point me towards an appropriate example or tutorial.

Many thanks,
Alan Searle.

PS: Maybe this could be a command call to Saxon? Or is there a standard
HTML way to do this? Maybe calling an XML file with the XSL stylesheet
as a parameter?
Apr 23 '06 #1
2 3275


Alan Searle wrote:
However, I would now like to generate a number of XML files and not
include the XSL file declaration in the header. Instead, I would like
to have an HTML 'index' offering a number of options that can be applied
to particular XML files. For example options might be opening
particular XML files either in 'detail', 'overview' or 'graphic' (SVG
chart) mode.


That processing instructon <?xml-stylesheet?> is mainly useful for
client-side XSLT where a browser user loads the XML document in a
browser window and the browser can then check for the xml-stylesheet
processing instruction and apply the stylesheet if it supports XSLT.
In theory you can provide several such processing instructions, see
<http://www.w3.org/TR/xml-stylesheet/>
with pseudo attributes like title and/or alternate and the browser could
then offer the stylesheets in a menu, the same way Mozilla for instance
does that for CSS stylesheets if you view HTML documents.

In practice I don't know of a browser supporting that however.

As with most stuff you get a much more useful solution if you go server
side and apply the transformation there, that way the browser deals with
the HTML or XML or SVG your stylesheet on the server produces and sends
to the client. That way you could have one server side application (e.g.
transformer.asp or transformer.jsp or transformer.cgi or
transformer.php) that could take the XML URL and the stylesheet URL or
file name as parameters in the query string, read out the query string
parameters, apply the transformation and send the result to the client.
You could then simply use a HTML form e.g.
<form action="transformer.jsp">
<select name="stylesheet">
<option value="html.xml">HTML sheet</option>
<option value="svg.xml">SVG sheet</option>
...
</select>
<input type="hidden" name="xmlInput" value="whatever.xml">
<input type="submit" value="show transformation result">
</form>
to let the user select a stylesheet.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 23 '06 #2
Martin Honnen schrieb:


Alan Searle wrote:
However, I would now like to generate a number of XML files and not
include the XSL file declaration in the header. Instead, I would like
to have an HTML 'index' offering a number of options that can be
applied to particular XML files. For example options might be opening
particular XML files either in 'detail', 'overview' or 'graphic' (SVG
chart) mode.

That processing instructon <?xml-stylesheet?> is mainly useful for
client-side XSLT where a browser user loads the XML document in a
browser window and the browser can then check for the xml-stylesheet
processing instruction and apply the stylesheet if it supports XSLT.
In theory you can provide several such processing instructions, see
<http://www.w3.org/TR/xml-stylesheet/>
with pseudo attributes like title and/or alternate and the browser could
then offer the stylesheets in a menu, the same way Mozilla for instance
does that for CSS stylesheets if you view HTML documents.

In practice I don't know of a browser supporting that however.

As with most stuff you get a much more useful solution if you go server
side and apply the transformation there, that way the browser deals with
the HTML or XML or SVG your stylesheet on the server produces and sends
to the client. That way you could have one server side application (e.g.
transformer.asp or transformer.jsp or transformer.cgi or
transformer.php) that could take the XML URL and the stylesheet URL or
file name as parameters in the query string, read out the query string
parameters, apply the transformation and send the result to the client.
You could then simply use a HTML form e.g.
<form action="transformer.jsp">
<select name="stylesheet">
<option value="html.xml">HTML sheet</option>
<option value="svg.xml">SVG sheet</option>
...
</select>
<input type="hidden" name="xmlInput" value="whatever.xml">
<input type="submit" value="show transformation result">
</form>
to let the user select a stylesheet.

Apr 23 '06 #3

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

Similar topics

3
by: Sarah Haskins | last post by:
I have a few questions about this problem I'm having involving XML, DTD, and XSL. I'm working with this DTD which defines a stylesheet, as such... <?xml version="1.0" encoding="UTF-8"?>...
9
by: Richard Silverstein | last post by:
I was hoping someone more expert in css could help me w. a problem I'm having w. a stylesheet I've created for a Pbase photo site. My site is at http://www.pbase.com/richards1052. Currently, it...
2
by: Jan Roland Eriksson | last post by:
Archive-name: www/stylesheets/authoring-faq Posting-Frequency: twice a week (Mondays and Thursdays) Last-modified: August 28, 2002 Version: 1.15 URL: http://css.nu/faq/ciwas-aFAQ.html...
0
by: Jan Roland Eriksson | last post by:
Archive-name: www/stylesheets/authoring-faq Posting-Frequency: twice a week (Mondays and Thursdays) Last-modified: April 10, 2003 Version: 1.16 URL: http://css.nu/faq/ciwas-aFAQ.html Maintainer:...
3
by: Ron Vecchi | last post by:
I'm pretty new to Xml and Xslt so bear with. I cant seem to add the xsl prefix to my stylesheet and get it to work. Error: The wrong namespace was used for XSL. Use...
7
by: sasquatch | last post by:
Hi, I've a a site with nested master pages and content pages. I tried using a theme with a stylesheet in the app_themes directory referencing it in the web.config file from a pages tag theme...
9
by: gkountz | last post by:
Hi: I am brand new to css and a have a limited amount of working knowledge regarding HTMl. This is primarily from using Frontpage. I recently purchased Stylemaster, a css authoring program,...
2
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
4
by: th1421 | last post by:
Hi, I'm new to FireFox. I am currently trying to convert my website to be compatible with it. Doing so I’m trying to process some XML/XSLT pages (preferably without using JavaScript). When I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...

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.