ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
RE: [xsl] Select statement within HREF
by Wendell Piez other posts by this author
Oct 31 2003 8:00PM messages near this date
[xsl] U+ conversion to Unicode characters | RE: [xsl] Select statement within HREF
Sajjad,

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
> fly.

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


======================================================================
Wendell Piez                            mailto:wapiez@[...].com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
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:  http://www.mulberrytech.com/xsl/xsl-list

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved