|
Subject: Re: [xsl] pass parameter to XSL From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Wed, 20 Feb 2008 18:55:31 +0530 |
Hi Izaskun,
If you are using JAXP to invoke the XSLT transformation, then you
can pass parameters to the stylesheet like following:
TransformerFactory tfactory = TransformerFactory.newInstance();
Transformer transformer = tfactory.newTransformer(xslSource);
transformer.setParameter("campo", "author"); //you set parameter, here
transformer.setParameter("moreParam", paramValue);
transformer.transform( ....
On Wed, Feb 20, 2008 at 6:44 PM, <igutierrez027@xxxxxxxxxxxxx> wrote:
> Hello everybody:
>
> I am spanish student and I am doing my Project in my university and I
> need help about how to pass a parameter to a XSL.
>
> I have one interface doing in Java. The user gives me a variable that I
> take like String. And I want to pass this variable to a XSL stylesheet
> to use it, but I don't know how to do this. I'm using Oxygen to work
> with
> XSL.
>
> This is my stylesheet:
>
> author and book are tags of the xml file. I have give the values to de
> field and class parameters. But the user gives me strings in the
> interface.
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform
> version="1.0" xmlns:pepe="http://bibtexml.sf.net/">
>
>
> <xsl:param name="campo" >author</xsl:param>
>
> <xsl:param name="clase">book</xsl:param>
> <xsl:template match="/">
> <xsl:value-of
> select="pepe:file/ pepe:entry/*[name()=$clase]/*[name()=$campo]"/>
> </xsl:template>
> </xsl:stylesheet>
>
> How I can pass the strings to the stylesheet?
> Thank you for your help.
>
> Izaskun
--
Regards,
Mukul Gandhi
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] pass parameter to XSL, igutierrez027 | Thread | [xsl] About Merchant Lynx Services, paul.kholer paul.kho |
| [xsl] pass parameter to XSL, igutierrez027 | Date | [xsl] About Merchant Lynx Services, paul.kholer paul.kho |
| Month |