cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boisvert, Eric" <ebois...@nrcan.gc.ca>
Subject RE: IncludeTransformer -- it works
Date Thu, 17 Jan 2008 15:47:42 GMT

 I'll be damned.. It works perfectly !

Here's my pipeline

<map:pipeline>
<map:match pattern="dev/get">
<!-- test STX POST trick -->
<map:generate src="document/ai.xml"/>
<map:transform type="stx" src="style/post.stx"/>
<map:serialize type="xml"/>
</map:match>
</map:pipeline>

It reads a document (ai.xml) that has 2 ARCXML calls - works exactly the same as WFS servers.


========== ai.xml =================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<proc>
<q1>
<ARCXML version="1.0">
	<REQUEST>
		<GET_FEATURES outputmode="newxml" geometry="true" featurelimit="1">
			<LAYER id="litho"/>
			<SPATIALQUERY subfields="FIELD1 FIELD2 #SHAPE#">
				<FEATURECOORDSYS id="4326"/>
				<FILTERCOORDSYS id="4326"/>
				<SPATIALFILTER relation="area_intersection">
					<ENVELOPE minx="12.5" miny="42.6" maxx="13.29" maxy="43.13"/>
				</SPATIALFILTER>
			</SPATIALQUERY>
		</GET_FEATURES>
	</REQUEST>
</ARCXML>
</q1>
<q2>
<ARCXML version="1.0">
	<REQUEST>
		<GET_FEATURES outputmode="newxml" geometry="true" featurelimit="1">
			<LAYER id="litho"/>
			<SPATIALQUERY subfields="FIELD3 FIELD4 #SHAPE#">
				<FEATURECOORDSYS id="4326"/>
				<FILTERCOORDSYS id="4326"/>
				<SPATIALFILTER relation="area_intersection">
					<ENVELOPE minx="12.5" miny="42.6" maxx="13.29" maxy="43.13"/>
				</SPATIALFILTER>
			</SPATIALQUERY>
		</GET_FEATURES>
	</REQUEST>
</ARCXML>
</q2>
</proc>


And here the STX

================ post.stx ==================================================
<?xml version="1.0" encoding="UTF-8"?>
<stx:transform xmlns:stx="http://stx.sourceforge.net/2002/ns" version="1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:sf="http://stx.sourceforge.net/2003/functions"
pass-through="all" output-method="xml" strip-space="yes">
<stx:buffer name="wfs"/>
<stx:template match="ARCXML">
<!-- load the ARCXML query in a buffer -->
<stx:result-buffer name="wfs" clear="yes">
	<ARCXML version="1.0">
		<stx:process-children/>
	</ARCXML>
</stx:result-buffer>
<!-- now send that baby to the server -->
<stx:process-buffer filter-method="http://www.ietf.org/rfc/rfc2616.txt#POST" name="wfs">
<stx:with-param name="target">http://some.esriArcIMS.Server.com/servlet/com.esri.esrimap.Esrimap?ServiceName=someDataStore&amp;CustomService=Query</stx:with-param>
</stx:process-buffer>
</stx:template>
</stx:transform>


And it does work.. 
STX in pass-through="all" just ignore the tags that does not match and pass them down the
stream, it only does something when it matches ARCXML tag.  So the result is indeed

<proc>
	<q1>
       the result of the first query
       </q1>
	<q2>
	the result of the second query
      </q2>
</proc>

CQFD ! (french speaking people will understand)

Cheers

Eric

P.S. 
Maybe a cleaner stx would be

<stx:process-self filter-method="http://www.ietf.org/rfc/rfc2616.txt#POST" name="wfs">
<stx:with-param name="target">http://some.esriArcIMS.Server.com/servlet/com.esri.esrimap.Esrimap?ServiceName=someDataStore&amp;CustomService=Query</stx:with-param>
</stx:process-self>

No need for a buffer.. I should try.

-----Message d'origine-----
De : Sébastien Geindre [mailto:sebastien.geindre@meteo.fr] 
Envoyé : 17 janvier 2008 10:35
À : users@cocoon.apache.org
Objet : Re: IncludeTransformer


> I never try, but I will shortly (like.. Today) for exactly the same 
> reasons Sébastien (to fetch data from a remote WFS).  STX is a bit 
> more tricky that XSLT but in a simple series of WFS calls, it should 
> be quite obvious.  The great benefit of STX is that it's SAX driven 
> (so I don't expect it should build a big buffer - GML documents tends 
> to be quite large)
>   
Great !!!
Hope you succeed..
> Wish me the best.
>   
we do !!! ;)
> Eric
>   



---------------------------------------------------------------------
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


Mime
View raw message