hi roman, this time I believe your writeDOMsession is good...
but the readDOMsession is not good :-) this time, the trigger-element means " the element that is present in the incoming SAX events, in your case "data/elems_1.xml" if you have the element <foo> in your incoming XML, the you can write <map:parameter name="trigger-element" value="foo"/> and the resulting XML will be : <foo><Elements>...</Elements>....</foo> Is that what you want? Cédric KOZLOV Roman wrote: >Cédric, > >Thank you very much for your help. I've changed dom-root-element according to your >remark (have set it to "Elements"), >but it was also necessary to remove "xmlns:collection" namespace declaration to get >it work. So I've modified stylesheet >element in my xsl like this: > ><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:collection="http://apache.org/cocoon/xmldb/1.0" > exclude-result-prefixes="collection"> > >Now "map:match" for writeDOMsession returns correct xml, however it seems that it is >not stored in a session, because I >can't read it in "map:match" for readDOMsession. There is still no "designations" >substring in cocoon's log's. >As a result of read request I get just the initial xml from generator's src without >content which is proposed to be >stored in a session. >Pattern for reading is: > > <map:match pattern="get_lub2"> > <map:generate src="data/elems_1.xml"/> > <map:transform type="readDOMsession"> > <map:parameter name="dom-name" value="designations"/> > <map:parameter name="trigger-element" value="Elements"/> > <map:parameter name="position" value="in"/> > </map:transform> > <map:serialize type="xml"/> > </map:match> > >where data/elems_1.xml (as well as a result of this match) is: > ><?xml version="1.0" encoding="iso-8859-1"?> ><Elements/> > >Why read/writeDOMsession don't work here? > >In sitemap.log I can see ERROR messages "no session object". What does it mean? >Should I create a session object myself? >If yes, how it is better to do? > >DEBUG (2002-03-21) 19:04.04:511 [sitemap.transformer.writeDOMsession] >(/bdl/get_lub) >HttpProcessor[8080][4]/WriteDOMSessionTransformer: WriteSessionTransformer: setup >ERROR (2002-03-21) 19:04.04:511 [sitemap.transformer.writeDOMsession] >(/bdl/get_lub) >HttpProcessor[8080][4]/WriteDOMSessionTransformer: WriteSessionTransformer: no >session object >DEBUG (2002-03-21) 19:04.04:521 [sitemap.generator.file] (/bdl/get_lub) >HttpProcessor[8080][4]/FileGenerator: >processing file xmldb:xindice://localhost:4080/db/data/somecollection/#//Some_Element >DEBUG (2002-03-21) 19:04.04:521 [sitemap.generator.file] (/bdl/get_lub) >HttpProcessor[8080][4]/FileGenerator: file >resolved to xmldb:xindice://localhost:4080/db/data/somecollection/ >ERROR (2002-03-21) 19:05.50:884 [sitemap.transformer.readDOMsession] >(/bdl/get_lub2) >HttpProcessor[8080][4]/ReadDOMSessionTransformer: ReadSessionTransformer: no session >object > > >Thank you for your help. > Roman > >Cédric Damioli wrote: > >>hi, >> >>you don't use the writeDOMsession in a proper way : >>the "dom-name" represents the name of the DOM stored in session >>the "dom-root-element" does NOT represent the root node of the stored >>DOM (leading to something like : <dom><Elements>....</Elements></dom>) , >>but the trigger element of the incoming SAX events which causes the >>Transformation to begin. >>In other words, you may try <map:parameter name="dom-root-element" >>value="Elements"/> and it may match your needs. >> >>KOZLOV Roman wrote: >> >>>Hello Christian, >>> >>>Thank you very much for response. I've not found any "designations" substring in >>>core.log. For the moment I've divided the match on two matches - one for read and >>>one for write (just for tests). >>>The match for write is: >>> >>><map:match pattern="get_lub"> >>> <map:generate >>>src="xmldb:xindice://localhost:4080/db/data/somecollection/#//Some_Element"/> >>> <map:transform src="stylesheets/render_query.xsl"/> >>> <map:transform type="writeDOMsession"> >>> <map:parameter name="dom-name" value="designations"/> >>> <map:parameter name="dom-root-element" value="dom"/> >>> </map:transform> >>> <map:serialize type="xml"/> >>></map:match> >>> >>>For this match I get empty response. >>>What's the matter? If I comment writeDOMsession transformer then I get xml like >>>this: >>> >>><?xml version="1.0" encoding="iso-8859-1" ?> >>><Elements xmlns:collection="http://apache.org/cocoon/xmldb/1.0"> >>> <Element id="ID_XXX">. . . </Element> >>>. . . >>></Elements> >>> >>>However, when writeDOMsession transformer is used then response is empty and in >>>core.log I can see: >>> >>>HttpProcessor[8080][0]/XMLDBSource: Querying collection >>>xmldb:xindice://localhost:4080/db/data/somecollection/; query= //Some_Element >>>FATAL_E (2002-03-21) 16:54.20:649 [core.xslt-processor] (/bdl/get_lub) >>>HttpProcessor[8080][0]/TraxErrorHandler: Error in TraxTransformer: >>>javax.xml.transform.TransformerException: java.lang.NullPointerException >>>javax.xml.transform.TransformerException: java.lang.NullPointerException >>>at >>>org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1230) >>> >>>at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3139) >>>at java.lang.Thread.run(Thread.java:484) >>>--------- >>>java.lang.NullPointerException >>>at >>>org.apache.cocoon.transformation.WriteDOMSessionTransformer.storePrefixMapping(WriteDOMSessionTransformer.java:183) >>> >>>at >>>org.apache.cocoon.transformation.WriteDOMSessionTransformer.startPrefixMapping(WriteDOMSessionTransformer.java:120) >>> >>>at >>>org.apache.xalan.transformer.ResultTreeHandler.startAndAddPrefixMappings(ResultTreeHandler.java:1107) >>> >>>at >>>org.apache.xalan.transformer.ResultTreeHandler.flushPending(ResultTreeHandler.java:941) >>> >>>at >>>org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:306) >>> >>>at >>>org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:716) >>>at >>>org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2186) >>> >>>at >>>org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2012) >>> >>>at >>>org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1175) >>> >>>at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3139) >>>at java.lang.Thread.run(Thread.java:484) >>> >>> >>> Looking forward to your help. >>> Thank you in advance. >>> Roman >>> >>> >>>Christian Haul wrote: >>> >>>>On 21.Mar.2002 -- 12:07 PM, KOZLOV Roman wrote: >>>> >>>>>processed, so that writeDOMsession is called always. Could you please >>>>>point to errors? >>>>> >>>>> <map:match pattern="get_lub"> >>>>> <map:match type="sessionstate" pattern="**"> >>>>> <map:parameter name="attribute-name" value="designations"/> >>>>> <map:transform type="readDOMsession"> >>>>> <map:parameter name="dom-name" value="designations"/> >>>>> <map:parameter name="trigger-element" value="/"/> >>>>> <map:parameter name="position" value="in"/> >>>>> </map:transform> >>>>> <map:serialize type="xml"/> >>>>> </map:match> >>>>> >>>>> <map:generate >>>>>src="xmldb:xindice://localhost:4080/db/data/somecollection/#//Some_Element"/> >>>>> >>>>> <map:transform src="stylesheets/render_query.xsl"/> >>>>> <map:transform type="writeDOMsession"> >>>>> <map:parameter name="dom-name" value="designations"/> >>>>> <map:parameter name="dom-root-element" value="dom"/> >>>>> </map:transform> >>>>> <map:serialize type="xml"/> >>>>> </map:match> >>>>> >>>>Roman, >>>>you seem to be missing a <map:generate/> in the upper >>>>pipeline. Anyway, could you check with core.log (?) that your session >>>>actually contains an attribute called "designations"? >>>> >>>> Chris. >>>> >>>>-- >>>>C h r i s t i a n H a u l >>>>[EMAIL PROTECTED] >>>> fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08 >>>> >>>>--------------------------------------------------------------------- >>>>Please check that your question has not already been answered in the >>>>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> >>>> >>>>To unsubscribe, e-mail: <[EMAIL PROTECTED]> >>>>For additional commands, e-mail: <[EMAIL PROTECTED]> >>>> >>>>--------------------------------------------------------------------- >>>>Please check that your question has not already been answered in the >>>>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> >>>> >>>>To unsubscribe, e-mail: <[EMAIL PROTECTED]> >>>>For additional commands, e-mail: <[EMAIL PROTECTED]> >>>> >>--------------------------------------------------------------------- >>Please check that your question has not already been answered in the >>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> >> >>To unsubscribe, e-mail: <[EMAIL PROTECTED]> >>For additional commands, e-mail: <[EMAIL PROTECTED]> >> > > >--------------------------------------------------------------------- >Please check that your question has not already been answered in the >FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> > >To unsubscribe, e-mail: <[EMAIL PROTECTED]> >For additional commands, e-mail: <[EMAIL PROTECTED]> > --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>