tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard A. Sand" <rs...@vgalleries.com>
Subject dynamic xsl?
Date Mon, 04 Jun 2001 15:50:31 GMT
Hi all - please excuse me if this is a stupid question.  I've been playing
around with the xsl tag libraries to make a simple help-system for a
website.  I'm putting all of the site's help information into a single XML
document, and then have an XSL document to take a single topic from the XML
data and display it as HTML.  The problem I have is how to tell the XSL page
which help topic to display out of all of the topics contained in the XML
file.  The topic requested by the user is part of the query string (i.e.
/help/help.jsp?topic=registration).

As a hack, my JSP page that invokes all of this reads the XML document, uses
a DOM parser to find the topic requested and outputs only that XML directly
inside an <xsl:apply> tag.  The XSL file then displays whichever topic was
provided.  What I want to do is pass along the requested topic to the XSL
page so that it can do something like:

<xsl:tempate match="topics[topic = registration]">

So, what I can't figure out is how to make the string "registration" inside
the xsl document be dynamically generated, so that it can contain any
keyword that I may have as a topic id.  Furthermore, if the topic id doesn't
exist, I want to display the default topic (something that says "no help
available" for example).

>From what I've read of Cocoon, I can make the XML document dynamic,
simplifying my JSP page, but that's still not what I really need to do- I
need to make the actual XSL page dynamic so that it can accept the topic
name from the query string (via the JSP page).

The help file is called "help.xml" and contains various topics divided into
topic tags such as:

<topics>
    <topic id="registration">
    ...
    </topic>
    <topic id="login">
    ...
    </topic>
    <topic id="forgottenpassword">
    ...
    </topic>
</topics>

Can someone tell me how to do this cleanly?

Also, if anyone has seen a good thorough DTD for XML help systems like I'm
writing I'd appreciate an example!  Mine is pretty basic and I'm sure this
has been done before.

Thanks!

Best regards,

Richard


Mime
View raw message