RE: [xsl] Select statement within HREF

Subject: RE: [xsl] Select statement within HREF
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 31 Oct 2003 15:00:16 -0500

Others' responses have tried to indicate why you are having a hard time accomplishing your linking. For whatever reason -- the topic is a complex one, having to do with the boundaries of an XSLT system (and one always has fun on the boundaries) -- it still hasn't become clear why this is difficult:

At 10:11 AM 10/31/2003, you wrote:
I am interested to see the following done by XSLT,

Approach 2:     1)      Keep the style sheet in top folder called F.
                2)    Only add PI to first and top level file.xml which
is in F.
                3)    Now, keep finding the nodes in top folder F,
making hyperlinks and including xml doc, file.xml on the

XSLT can create any hyperlink you like, but in a nutshell, the question is: what should this hyperlink look like?

It could look like <a href="f1/f11/documentA.xml">Document A</a>. The problem there is that you have stipulated that it is difficult (prohibitively?) for you to provide every documentA.xml with an xml-stylesheet PI; accordingly it won't get processed with your stylesheet, since the system has no way of knowing what stylesheet to use.

The link could look like <a href="f1/f11/documentA.html">Document A</a>. The problem here is that this HTML doesn't exist, so the link will return a 404 Not Found error. There are two ways around this: both have been suggested already in this thread:
1. Batch process ahead of time, so that documentA.html does in fact exist (having been created by running the documentA.xml through the transformation) and can be served.
2. Run an XSLT processor on the server side at the time the file is requested, using a framework such as Cocoon, PHP, 4Suite (a Python library that provides this functionality), or any other server technology that can see the request for DocumentA.html and return such an HTML document from the appropriate XML source and stylesheet.

Or alternatively, the link could look like <a href="javascript:transform('DocumentA.xml','stylesheet.xsl')">Document A</a> or some such. This allows you to serve the XML directly and the client to perform the transformation; of course you have to write, integrate and test the scripting that will invoke the transformation, take on the problems of platform-independence yourself, etc. etc.

All of these have been suggested already, and any of them could work. Which one is best for you, we can't tell.

But since XSLT does not specify how browsers should associate XML documents with stylesheets (a separate spec describes the xml-stylesheet PI, which is apparently of limited use to you), and since there is no standard linking syntax that all web servers will recognize as saying "get this XML document, transformed with this stylesheet", you are left to program or configure this functionality in the toolkit or server technology of your choice.

Only after you have dealt with this integration issue can you know what the link should look like; and only then does it become an XSLT problem (and a trivial one).

I hope this helps,

====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

XSL-List info and archive:

Current Thread