You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Tristan Lyons <tr...@hmlyons.com> on 2003/12/02 23:35:17 UTC

request xml tags disappear

I'm having a strange problem with a transformer. I'm trying to access an XML
doc passed as a variable with a POST.

I use the RequestGenerator to generate an xml doc for the request (If I
output that XML at this point it looks normal, see below). Then I transform
that doc with req2xmlDoc.xls. The problem is that somehow all the XML tags
have been removed!?

Anyone see where I've gone wrong?
-Tristan

The response looks like this,
========================
<?xml version="1.0" encoding="ISO-8859-1"?>
<topElement>
localhost:8888Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5)
Gecko/20031007text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1en-us,en;q=0
.5gzip,deflateISO-8859-1,utf-8;q=0.7,*;q=0.7300keep-aliveapplication/x-www-f
orm-urlencoded47&lt;SomeTag&gt;some text&lt;/SomeTag&gt;
</topElement>


The request (as it looks if I bypass the XSLT transform),
============================
<?xml version="1.0" encoding="ISO-8859-1"?>
<h:request xmlns:h="http://apache.org/cocoon/request/2.0"
target="/mySite/mirror" source="">
	<h:requestHeaders>
		... a bunch of headers, omitted for brevity
	</h:requestHeaders>
	<h:requestParameters>
		<h:parameter name="xmlDoc">
			<h:value>&lt;SomeTag&gt;some text&lt;/SomeTag&gt;</h:value>
		</h:parameter>
	</h:requestParameters>
	<h:requestAttributes/>
	<h:configurationParameters>
		<h:parameter name="test">yes</h:parameter>
	</h:configurationParameters>
</h:request>


req2xmlDoc.xsl looks like (I've simplified this to try and figure out what
the problem is)
=============================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

	<xsl:template match="/">
		<topElement>
			<xsl:value-of select="."/>
		</topElement>
	</xsl:template>

</xsl:stylesheet>


My Sitemap,
==================
<map:pipeline>
<map:match pattern="*.xml">
<!-- generate xml request doc -->
<map:generate type="request"/>
<!-- xsl transform to create input doc for source writing transform -->
<map:transform type="xslt" src="req2xmlDoc.xsl"/>
<map:serialize type="xml"/>
</map:match>
</map:pipeline>



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


Re: request xml tags disappear

Posted by Joerg Heinicke <jo...@gmx.de>.
If I understand your problem correctly it's an XSLT problem. 
<xsl:value-of select="."/> gets only the text value of '.' and no XML 
elements. You should use <xsl:copy-of select="."/> to copy the whole 
structure to the output.

Joerg

On 02.12.2003 23:35, Tristan Lyons wrote:

> I'm having a strange problem with a transformer. I'm trying to access an XML
> doc passed as a variable with a POST.
> 
> I use the RequestGenerator to generate an xml doc for the request (If I
> output that XML at this point it looks normal, see below). Then I transform
> that doc with req2xmlDoc.xls. The problem is that somehow all the XML tags
> have been removed!?
> 
> Anyone see where I've gone wrong?
> -Tristan
> 
> The response looks like this,
> ========================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <topElement>
> localhost:8888Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5)
> Gecko/20031007text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
> ,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1en-us,en;q=0
> .5gzip,deflateISO-8859-1,utf-8;q=0.7,*;q=0.7300keep-aliveapplication/x-www-f
> orm-urlencoded47&lt;SomeTag&gt;some text&lt;/SomeTag&gt;
> </topElement>
> 
> 
> The request (as it looks if I bypass the XSLT transform),
> ============================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <h:request xmlns:h="http://apache.org/cocoon/request/2.0"
> target="/mySite/mirror" source="">
> 	<h:requestHeaders>
> 		... a bunch of headers, omitted for brevity
> 	</h:requestHeaders>
> 	<h:requestParameters>
> 		<h:parameter name="xmlDoc">
> 			<h:value>&lt;SomeTag&gt;some text&lt;/SomeTag&gt;</h:value>
> 		</h:parameter>
> 	</h:requestParameters>
> 	<h:requestAttributes/>
> 	<h:configurationParameters>
> 		<h:parameter name="test">yes</h:parameter>
> 	</h:configurationParameters>
> </h:request>
> 
> 
> req2xmlDoc.xsl looks like (I've simplified this to try and figure out what
> the problem is)
> =============================
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> 
> 	<xsl:template match="/">
> 		<topElement>
> 			<xsl:value-of select="."/>
> 		</topElement>
> 	</xsl:template>
> 
> </xsl:stylesheet>




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


Re: request xml tags disappear

Posted by Guido Casper <gc...@s-und-n.de>.
Try to name your request parameter xml:xmlDoc.
The RequestGenerator tries to parse parameters, that start with "xml:"

HTH
Guido

Tristan Lyons wrote:
> I'm having a strange problem with a transformer. I'm trying to access
> an XML doc passed as a variable with a POST.
>
> I use the RequestGenerator to generate an xml doc for the request (If
> I output that XML at this point it looks normal, see below). Then I
> transform that doc with req2xmlDoc.xls. The problem is that somehow
> all the XML tags have been removed!?
>
> Anyone see where I've gone wrong?
> -Tristan
>
> The response looks like this,
> ========================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <topElement>
> localhost:8888Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5)
>
Gecko/20031007text/xml,application/xml,application/xhtml+xml,text/html;q
=0.9
>
,text/plain;q=0.8,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1en-us,en
;q=0
>
.5gzip,deflateISO-8859-1,utf-8;q=0.7,*;q=0.7300keep-aliveapplication/x-w
ww-f
> orm-urlencoded47&lt;SomeTag&gt;some text&lt;/SomeTag&gt;
> </topElement>
>
>
> The request (as it looks if I bypass the XSLT transform),
> ============================
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <h:request xmlns:h="http://apache.org/cocoon/request/2.0"
> target="/mySite/mirror" source="">
> <h:requestHeaders>
> ... a bunch of headers, omitted for brevity
> </h:requestHeaders>
> <h:requestParameters>
> <h:parameter name="xmlDoc">
> <h:value>&lt;SomeTag&gt;some text&lt;/SomeTag&gt;</h:value>
> </h:parameter>
> </h:requestParameters>
> <h:requestAttributes/>
> <h:configurationParameters>
> <h:parameter name="test">yes</h:parameter>
> </h:configurationParameters>
> </h:request>
>
>
> req2xmlDoc.xsl looks like (I've simplified this to try and figure out
> what the problem is)
> =============================
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>
> <xsl:template match="/">
> <topElement>
> <xsl:value-of select="."/>
> </topElement>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> My Sitemap,
> ==================
> <map:pipeline>
> <map:match pattern="*.xml">
> <!-- generate xml request doc -->
> <map:generate type="request"/>
> <!-- xsl transform to create input doc for source writing transform
> --> <map:transform type="xslt" src="req2xmlDoc.xsl"/>
> <map:serialize type="xml"/>
> </map:match>
> </map:pipeline>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


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