Hello,
yes, that may help me.
But I would like a cleaner solutions.

I explain:
Right now I have a xsl extension function "samplefunction" that return the
string: <center>hello</center>.
If I insert this:
<xsl:value-of disable-output-escaping="yes"
select="publishing2:samplefunction()"/>
 in my xsl file,
everything is fine, and I get the right HTML (thanks Baptiste).

But I would like a cleaner solutions, I would like to insert just:
<publishing2:sampleelement/>
in my xsl file.

As Gary pointed it seems I need to return a NodeSet instead of a String.
But I am new to NodeSet, and I am not finding any sample using NodeSet,
can anyone point me to any NodeSet sample;
or sample of a xsl extension element returning html code.

Thanks very much u all for your help

Regards

Victor






----- Original Message -----
From: "Baptiste Burgaud" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 02, 2001 10:21 AM
Subject: Re: Inserting HTML into the result tree


> Hi Victor,
>
> I'm not sure of what you want to do (and how...) but this may help:
>
> "maBelleBaliseRawHTML" template allow non XHTML output and the "par"
> template shows how to create your own tag without the xsl:element
> instruction (it actually creates an HTML comment as the xsl:comment tag
does
> not seems to work when outputing html)
>
> File helloWorld.java:
> // compilation: javac -classpath
> ".;d:\tmp;d:\tmp\xalan-j_2_0_1\bin\xalan.jar" %f
> // execution: java -classpath
".;d:\tmp;d:\tmp\xalan-j_2_0_1\bin\xalan.jar"
> HelloWorld
>
> import javax.xml.transform.*;
> import javax.xml.transform.stream.*;
>
> import java.io.*;
>
> public class HelloWorld
> {
>  public static void main(String[] args)
>     throws TransformerException, TransformerConfigurationException,
>            FileNotFoundException, IOException
>   {
>    TransformerFactory tFactory = TransformerFactory.newInstance();
>    Transformer transformer = tFactory.newTransformer(new
> StreamSource("helloWorld.xsl"));
>    transformer.transform(new StreamSource("helloWorld.xml"), new
> StreamResult(new FileOutputStream("helloWorld.html")));
>
>    System.out.println("************* The result is in helloWorld.html
> *************");
>   }
> }
>
>
> File helloWorld.xsl:
> <?xml version="1.0" ?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> version="1.0">
> <xsl:output method = "html"/>
> <xsl:comment>this won't output anything!</xsl:comment>
>
>   <xsl:template match="monBeauDocument">
>     <HTML>
>       <HEAD>
>         <TITLE><xsl:value-of select="monBeauTitre"/></TITLE>
>       </HEAD>
>       <BODY>
>         <center>hello</center>
>         <xsl:apply-templates select="maBelleBaliseRawHTML"/>
>         <xsl:apply-templates select="par"/>
>       </BODY>
>     </HTML>
>   </xsl:template>
>
>   <xsl:template match="maBelleBaliseRawHTML">
>     <xsl:value-of disable-output-escaping="yes" select="."/>
>   </xsl:template>
>
>   <xsl:template match="par">
>   <H4>
>     <xsl:text disable-output-escaping="yes"><![CDATA[<!--]]></xsl:text>
>       <xsl:value-of select="@id"/>
>     <xsl:text disable-output-escaping="yes"><![CDATA[-->]]></xsl:text>
>     <xsl:value-of select="."/>
>   </H4>
>   </xsl:template>
>
> </xsl:stylesheet>
>
> File helloWorld.xml:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <monBeauDocument>
>   <monBeauTitre>
>     Hello World
>   </monBeauTitre>
>   <par id="123">
>     un beau paragraphe
>   </par>
>   <maBelleBaliseRawHTML>
>     <![CDATA[
>       <ul>
>         <li>coucou<br>
>         <li>&amp;YOUHOU<BR>
>       </ul>
>     ]]>
>   </maBelleBaliseRawHTML>
> </monBeauDocument>
>
>
>
> ----- Original Message -----
> From: "Victor M. Moreno" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, August 02, 2001 9:37 AM
> Subject: Re: Inserting HTML into the result tree
>
>
> > Thanks Gary,
> > can you show me any sample in the xalan package?
> >
> > regards
> >
> > Victor
> >
> >
> > > "Victor M. Moreno" wrote:
> > > > Does the xsl extension element have to return a nodeset instead of a
> > String
> > > > as I am doing
> > > > right now?
> > >
> > > Yes.
> > >
> > > ---------------------------------------------------------------------
> > > In case of troubles, e-mail:     [EMAIL PROTECTED]
> > > To unsubscribe, e-mail:          [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > In case of troubles, e-mail:     [EMAIL PROTECTED]
> > To unsubscribe, e-mail:          [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     [EMAIL PROTECTED]
> To unsubscribe, e-mail:          [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to