Re: RE: [none] (Wendy's question)

Subject: Re: RE: [none] (Wendy's question)
From: "Steve Muench" <SMUENCH@xxxxxxxxxxxxx>
Date: 26 Feb 99 11:54:17 -0800
My poor-man's solution to this at the moment is
using a JSP page to dynamically return a stylesheet
including a parameter passed in from the HTTP request.

In the example below, the stylesheet uses the

<%= request.getParameter("cat") %>

to plug in the value of the HTTP request parameter named
"cat" into my stylesheet.

When I want to use the stylesheet, I refer to it by URL
like:

      http://mymachine.com/MyStyleSheet.jsp?cat=Foobar

and the right sheet is returned.

Having XSL constants whose values could be set by the
processor ahead of time would be a more elegant solution
to this.

+--- MyStyleSheet.jsp ------------------------------------------

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";
                xmlns="http://www.w3.org/TR/REC-html40";
                result-ns="">
<xsl:template match="/">
  <xsl:for-each select="Site/Category">
    <xsl:if test='.[Name="<%= request.getParameter("cat") %>"]'>
                          <!-- above is JSP syntax       -->
       :
    </xsl:if>
  </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

____________________________________________________________
Steve Muench, Consulting Product Mgr & XML Evangelist
Java Business Objects Dev't Team - http://www.oracle.com/xml
--- Begin Message ---
Subject: RE: [none] (Wendy's question)
From: Mike Dierken <mike@xxxxxxxxxxxxxxx>
Date: 26 Feb 99 10:45:38
I had previously thought of using entity references for this purpose, but it
turns out not be a viable solution.

It would have been nice to be able to say:
    <xsl:for-each select='@attribute=&search.for;'>

Before performing transformNode(), I would have used the DOM to access the
entity table of the DTD (probably an internal DTD) and modified the entity
value. Unfortunately this is not allowed, per the XML 1.0 spec.

It would have been very nice, on a server, to keep the DOM of the stylesheet
in memory and modify these entity values for each transaction, and let the
transform take place. Multi-threading issues might have required a different
DOM per thread, or it might have required access to the entity table to be
based upon the current thread. Alas, entities are not allowed to be modified
after a document is parsed. A DOM will have no entity reference nodes. Oh
well.

It looks like the search and replace functionality has to be hand coded by
each application developer.

Mike


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

--- End Message ---
Current Thread