RE: [xsl] XSL doesn't received/recognized parameters send from servlet

Subject: RE: [xsl] XSL doesn't received/recognized parameters send from servlet
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 8 Feb 2002 13:31:54 -0000
I missed the fact that the <xsl:param> elements were not top-level. That's
the explanation, of course.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Michael Kay
> Sent: 08 February 2002 11:58
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE: [xsl] XSL doesn't received/recognized parameters
> send from
> servlet
>
>
> What XSLT processor are you using?
>
> And what is XString?
>
> The mapping from Java objects to XPath data types in
> setParameter() is not
> defined by JAXP 1.1, and varies a little from one product to another.
> Supplying a String as the parameter value should be OK.
>
> Displaying the actual values of the parameters within the
> output file might
> be helpful.
>
> Michael Kay
> Software AG
> home: Michael.H.Kay@xxxxxxxxxxxx
> work: Michael.Kay@xxxxxxxxxxxxxx
>
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> > Rosely Kumoi
> > Sent: 08 February 2002 03:31
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] XSL doesn't received/recognized parameters send from
> > servlet
> >
> >
> > Servlet code: <using the TRAX library>
> >         String ttl = request.getParameter("ttl");
> >         String lang = request.getParameter("lang");
> >         response.setContentType("text/html");
> >
> >         try
> >         {
> >             TransformerFactory tFactory =
> > TransformerFactory.newInstance();
> >             Transformer transformer = tFactory.newTransformer(new
> > StreamSource("glossary.xsl"));
> >
> >             // Set the stylesheet parameter
> >             transformer.setParameter("ttl", new XString(ttl));
> >             transformer.setParameter("lang", new XString(lang));
> >
> >            // Perform the transformation.
> >            transformer.transform(new
> StreamSource("glossary.xml"), new
> > StreamResult(out));
> >        }
> >        catch (Exception ex)
> >        {
> >             System.out.println(ex);
> >        }
> >
> > End of Servlet code.
> >
> > XSL code:
> >
> > <?xml version='1.0'?>
> >
> > <xsl:transform
> >      xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> >      version="1.0">
> >
> >  <xsl:template name="print-glossary">
> >   <HTML>
> >   <BODY>
> >
> >   <xsl:param name="ttl"/>
> >   <xsl:param name="lang"/>
> >   <xsl:for-each select="glossary/term[@title=$ttl]">
> >       <FONT COLOR="RED">
> >        <xsl:for-each select="content[@language=$lang]">
> >         <P><xsl:value-of select="."/> </P>
> >        </xsl:for-each>
> >       </FONT>
> >   </xsl:for-each>
> >   </BODY>
> >   </HTML>
> >  </xsl:template>
> >
> >  <xsl:template match="/">
> >   <xsl:call-template name="print-glossary">
> >    <xsl:with-param name="ttl">default value</xsl:with-param>
> >    <xsl:with-param name="lang">default value</xsl:with-param>
> >   </xsl:call-template>
> >  </xsl:template>
> >
> > </xsl:transform>
> >
> > End of XSL code.
> >
> > I also have tried using this code for the parameter passing:
> >     transformer.setParameter("ttl", "'" + ttl + "'");
> > also doesn't work, any help or workaround - I thanx in advanced
> >
> > rosely kumoi
> >
> >
> >  XSL-List info and archive:
> http://www.mulberrytech.com/xsl/xsl-list
> >
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>


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


Current Thread