cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Agler" <ryanag...@hotmail.com>
Subject RE: [Off-topic:XSLT] Passing an XML fragment via a HTML form.
Date Wed, 23 Oct 2002 17:50:39 GMT
It will work for a textarea if that is an option, but for an input, all
the tags get stripped out and just the content gets included.

-----Original Message-----
From: Robert Koberg [mailto:rob@koberg.com] 
Sent: Wednesday, October 23, 2002 1:41 PM
To: cocoon-users@xml.apache.org
Subject: RE: [Off-topic:XSLT] Passing an XML fragment via a HTML form.

Hi,

Can you simply do:

<input name="txtNode">
<xsl:attribute name="value">
<xsl:copy-of select="/page/thing"/>
</xsl:attribute>
</input>

or perhaps:

<textarea>
<xsl:copy-of select="/page/thing"/>
</textarea>

best,
-Rob

> -----Original Message-----
> From: Ryan Agler [mailto:ryanagler@hotmail.com]
> Sent: Wednesday, October 23, 2002 10:20 AM
> To: cocoon-users@xml.apache.org
> Subject: RE: [Off-topic:XSLT] Passing an XML fragment via a HTML form.
> 
> 
> I had this problem too, and had to write a custom java class to do
this
> inside XSLT, but it works.  
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0" xmlns:java="http://xml.apache.org/xslt/java"
> exclude-result-prefixes="java">
> <xsl:template match="/">
> <xsl:variable name="convertThisNode">
> <xsl:copy-of select="/page/thing"/>
> </xsl:variable>
> <html>
> <form>
> <input name="txtNode"><xsl:attribute name="value">
> <xsl:value-of
>
select="java:agler.SerializeXml.serializeXml($convertThisNode)"/></xsl:a
> ttribute>
> </input>
> </form>
> </html>
> </xsl:template>
> </xsl:stylesheet>
> 
> Not sure if you are familiar with making your own Jars (took me awhile
> to figure out), but if you are, create you own jar and make it
available
> to Cocoon by putting it in Tomcat's common/lib and reference it in
> web.xml's extra-classpath.  Here is the source for SerializeXml:
> 
> package agler;
> import org.w3c.dom.Node;
> import org.apache.xalan.serialize.SerializerToXML;
> import java.io.StringWriter;
> public class SerializeXml
> {
>    public static String serializeXml(Node node)
>    {
>       String ret = "";
>       try 
>       {
>         StringWriter sw = new StringWriter();
>         SerializerToXML serxml = new SerializerToXML();
>         serxml.setWriter(sw);
>         serxml.serialize(node);
> 	  ret = sw.toString();
>       }
>       catch (Exception e){}
>       return ret;
>    }
> }
> 
> Hope this helps, good luck.
> +Ryan
> 
> 
> 
> 
> -----Original Message-----
> From: ROSSEL Olivier [mailto:olivier.rossel@airbus.com] 
> Sent: Wednesday, October 23, 2002 5:05 AM
> To: 'cocoon-users@xml.apache.org'
> Subject: [Off-topic:XSLT] Passing an XML fragment via a HTML form.
> 
> I have a HTML form, created from a XML file and a XSL Treansformation.
> 
> I need to pass a subtree of that XML as a parameter, via that form.
> 
> Is there a way, in XSLT, to transform a XML fragment into a string?
> So I can have an <input> in my form that contains the text of this XML
> fragment.
> 
> Corrolair when processing parameters sent by the form: 
> is there a way, in XSLT, to transform as string into a XML fragment?
> 
> 
> 
> 
> ---cut here---
> 
> 
> This e-mail is intended only for the above addressee. It may contain
> privileged information. If you are not the addressee you must not
copy,
> distribute, disclose or use any of the information in it. If you have
> received it in error please delete it and immediately notify the
sender.
> Security Notice: all e-mail, sent to or from this address, may be
> accessed by someone other than the recipient, for system management
and
> security reasons. This access is controlled under Regulation of
> Investigatory Powers Act 2000, Lawful Business Practises.
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
> For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>
> 


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message