xslt processor in xpl action

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

xslt processor in xpl action

MarcinKula
Hi,

I have problem with using xslt processor in the xpl file.

At first I definied simply xml, xsd and xslt file (transform.xsl).
After this I attached xslt processor in the load-xml.xpl file.

At the xform document I have two input fields
and one upload control, which is connected to the load xml action.

load-xml.xpl
--------------
[...]

<p:processor name="oxf:request">
    <p:input name="config">
        <config>
                <include>/request/container-type</include>
        </config>
    </p:input>
    <p:output name="data" id="container-type"/>
</p:processor>

<p:processor name="oxf:pipeline">
    <p:input name="config" href="read-uri.xpl"/>
        <p:input name="uri" href="aggregate('uri', #instance#xpointer(string(/files/file[. != ''][1])))"/>
        <p:output name="data" id="file"/>
    </p:processor>
               

<p:processor name="oxf:xslt">
   <p:input name="config" href="transform.xsl"/>
   <p:input name="data" href="#file"/>
   <p:output name="data" id="xsl-output"/>
</p:processor>


<p:processor name="oxf:http-serializer">
     <p:input name="data" href="#xsl-output"/>
       <p:input name="config">
        <config>
            <content-type>text/xml</content-type>
            <force-content-type>true</force-content-type>
            <cache-control>
                <use-local-cache>false</use-local-cache>
            </cache-control>
        </config>
       </p:input> 
</p:processor>                       
[...]

I fired upload action and I had an error in the log:
2008-11-12 10:05:22,447 ERROR ProcessorService  - Exception at oxf:/apps/test/xslt/transform.xsl (executing XSLT transformation)
org.orbeon.oxf.common.OXFException: Undeclared prefix in xsi:type: xs at org.orbeon.oxf.processor.serializer.BinaryTextContentHandler.startElement(BinaryTextContentHandler.java:124)
at org.orbeon.oxf.xml.SimpleForwardingContentHandler.startElement(SimpleForwardingContentHandler.java:69)
at org.orbeon.oxf.processor.transformer.xslt.XSLTTransformer$3.startElement(XSLTTransformer.java:267)
[...]

I tried to add some additional namespaces, but I always have this error.
I searched at the ops forum, studied examples of xforms, xpl pages
but I haven't found any solution.

My xslt file is correct, but only without xslt processor everything works fine.
In other application I used xslt transformation in page-flow file and it was working correctly.

I attached my all files in a zip archive.
File to upload: toUpload.xml

I tested it in Orbeon 3.6 and 3.7 beta1.

Thank you in advance,
Marcin.

test.zip
Reply | Threaded
Open this post in threaded view
|

RE: xslt processor in xpl action

Steve Bayliss
In test1.xhtml, try adding the xmlns:xs declaration to the <xf:bind ../>
node at line 28 (yes, I know it is also declared for the whole document!)

It could be that in the <xf:model ... > you need namespace declarations
local to the model (as if it is an independent XML document).

-----Original Message-----
From: MarcinKula [mailto:[hidden email]]
Sent: 12 November 2008 16:29
To: [hidden email]
Subject: [ops-users] xslt processor in xpl action



Hi,

I have problem with using xslt processor in the xpl file.

At first I definied simply xml, xsd and xslt file (transform.xsl). After
this I attached xslt processor in the load-xml.xpl file.

At the xform document I have two input fields
and one upload control, which is connected to the load xml action.

load-xml.xpl
--------------
[...]
<!-- Get container type -->
<p:processor name="oxf:request">
    <p:input name="config">
        <config>
                <include>/request/container-type</include>
        </config>
    </p:input>
    <p:output name="data" id="container-type"/>
</p:processor>

<p:processor name="oxf:pipeline">
    <p:input name="config" href="read-uri.xpl"/>
        <p:input name="uri" href="aggregate('uri',
#instance#xpointer(string(/files/file[. != ''][1])))"/>
        <p:output name="data" id="file"/>
    </p:processor>
               
<!-- Run xsl-->
<p:processor name="oxf:xslt">
   <p:input name="config" href="transform.xsl"/>
   <p:input name="data" href="#file"/>
   <p:output name="data" id="xsl-output"/>
</p:processor>

<!-- Send the data to the browser -->
<p:processor name="oxf:http-serializer">
     <p:input name="data" href="#xsl-output"/>
       <p:input name="config">
        <config>
            <content-type>text/xml</content-type>
            <force-content-type>true</force-content-type>
            <cache-control>
                <use-local-cache>false</use-local-cache>
            </cache-control>
        </config>
       </p:input>
</p:processor>
[...]

I fired upload action and I had an error in the log:
2008-11-12 10:05:22,447 ERROR ProcessorService  - Exception at
oxf:/apps/test/xslt/transform.xsl (executing XSLT transformation)
org.orbeon.oxf.common.OXFException: Undeclared prefix in xsi:type: xs at
org.orbeon.oxf.processor.serializer.BinaryTextContentHandler.startElement(Bi
naryTextContentHandler.java:124)
at
org.orbeon.oxf.xml.SimpleForwardingContentHandler.startElement(SimpleForward
ingContentHandler.java:69)
at
org.orbeon.oxf.processor.transformer.xslt.XSLTTransformer$3.startElement(XSL
TTransformer.java:267)
[...]

I tried to add some additional namespaces, but I always have this error. I
searched at the ops forum, studied examples of xforms, xpl pages
but I haven't found any solution.

My xslt file is correct, but only without xslt processor everything works
fine. In other application I used xslt transformation in page-flow file and
it was working correctly.

I attached my all files in a zip archive.
File to upload: toUpload.xml

I tested it in Orbeon 3.6 and 3.7 beta1.

Thank you in advance,
Marcin.

http://www.nabble.com/file/p20463859/test.zip test.zip
--
View this message in context:
http://www.nabble.com/xslt-processor-in-xpl-action-tp20463859p20463859.html
Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: xslt processor in xpl action

MarcinKula
Thank you for your replay.

I tried to modify line 28 like this:
<xf:bind id="file" nodeset="file" type="xs:anyURI" <b>xmlns:xs="http://www.w3.org/2001/XMLSchema"/>

But I have the same error.

-Marcin

Steve Bayliss wrote
In test1.xhtml, try adding the xmlns:xs declaration to the <xf:bind ../>
node at line 28 (yes, I know it is also declared for the whole document!)

It could be that in the <xf:model ... > you need namespace declarations
local to the model (as if it is an independent XML document).

-----Original Message-----
From: MarcinKula [mailto:mkulazinski@sygnity.pl]
Sent: 12 November 2008 16:29
To: ops-users@ow2.org
Subject: [ops-users] xslt processor in xpl action

[...]

I fired upload action and I had an error in the log:
2008-11-12 10:05:22,447 ERROR ProcessorService  - Exception at
oxf:/apps/test/xslt/transform.xsl (executing XSLT transformation)
org.orbeon.oxf.common.OXFException: Undeclared prefix in xsi:type: xs at
org.orbeon.oxf.processor.serializer.BinaryTextContentHandler.startElement(Bi
naryTextContentHandler.java:124)
at
org.orbeon.oxf.xml.SimpleForwardingContentHandler.startElement(SimpleForward
ingContentHandler.java:69)
at
org.orbeon.oxf.processor.transformer.xslt.XSLTTransformer$3.startElement(XSL
TTransformer.java:267)
[...]
Reply | Threaded
Open this post in threaded view
|

Re: RE: xslt processor in xpl action

fl.schmitt(ops-users)
MarcinKula schrieb:

> I tried to modify line 28 like this:
> <xf:bind id="file" nodeset="file" type="xs:anyURI"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
>
> But I have the same error.

>> [...]
>>
>> I fired upload action and I had an error in the log:
>> 2008-11-12 10:05:22,447 ERROR ProcessorService  - Exception at
>> oxf:/apps/test/xslt/transform.xsl (executing XSLT transformation)
>> org.orbeon.oxf.common.OXFException: Undeclared prefix in xsi:type: xs at
>> org.orbeon.oxf.processor.serializer.BinaryTextContentHandler.startElement(Bi
>> naryTextContentHandler.java:124)
>> at
>> org.orbeon.oxf.xml.SimpleForwardingContentHandler.startElement(SimpleForward
>> ingContentHandler.java:69)
>> at
>> org.orbeon.oxf.processor.transformer.xslt.XSLTTransformer$3.startElement(XSL
>> TTransformer.java:267)
>> [...]
i'm no xstl expert, but the error occurs when the xslt transformation is
executed - so you maybe have to add a namespace for xs to the xsl
stylesheet, too.

HTH
florian



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: xslt processor in xpl action

MarcinKula
I added a namespace for xs to the xsl stylesheet and ... to the all files in the project.
I have the same error.

As I said I checked this transformation in other application and it was working correctly.

I found the problem with the same error name:
http://www.nabble.com/Undeclared-prefix-in-xsi%3Atype%3A-xs-to13564818.html#a13564818

Maybe this is a bug ...

I modified and attached my all files in a zip archive.
test.zip

-Marcin

fs(ops-users) wrote
MarcinKula schrieb:

> I tried to modify line 28 like this:
> <xf:bind id="file" nodeset="file" type="xs:anyURI"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
>
> But I have the same error.

>> [...]
>>
>> I fired upload action and I had an error in the log:
>> 2008-11-12 10:05:22,447 ERROR ProcessorService  - Exception at
>> oxf:/apps/test/xslt/transform.xsl (executing XSLT transformation)
>> org.orbeon.oxf.common.OXFException: Undeclared prefix in xsi:type: xs at
>> org.orbeon.oxf.processor.serializer.BinaryTextContentHandler.startElement(Bi
>> naryTextContentHandler.java:124)
>> at
>> org.orbeon.oxf.xml.SimpleForwardingContentHandler.startElement(SimpleForward
>> ingContentHandler.java:69)
>> at
>> org.orbeon.oxf.processor.transformer.xslt.XSLTTransformer$3.startElement(XSL
>> TTransformer.java:267)
>> [...]

i'm no xstl expert, but the error occurs when the xslt transformation is
executed - so you maybe have to add a namespace for xs to the xsl
stylesheet, too.

HTH
florian
Reply | Threaded
Open this post in threaded view
|

RE: Re: RE: xslt processor in xpl action

Steve Bayliss
Yes, sounds like a bug.

Try adding a dummy xs:something element in your model somewhere - maybe that
will get the namespace prefix declaration to propagate, from reading the bug
report URL you posted it sounds like that could be the source of the
problem...  Maybe because the only usage of xs: is within an attribute
value, something somewhere is dropping the namespace declaration.

-----Original Message-----
From: MarcinKula [mailto:[hidden email]]
Sent: 13 November 2008 13:45
To: [hidden email]
Subject: [ops-users] Re: RE: xslt processor in xpl action



I added a namespace for xs to the xsl stylesheet and ... to the all files in
the project. I have the same error.

As I said I checked this transformation in other application and it was
working correctly.

I found the problem with the same error name:
http://www.nabble.com/Undeclared-prefix-in-xsi%3Atype%3A-xs-to13564818.html#
a13564818

Maybe this is a bug ...

I modified and attached my all files in a zip archive.
http://www.nabble.com/file/p20481060/test.zip test.zip

-Marcin


fs(ops-users) wrote:

>
> MarcinKula schrieb:
>
>> I tried to modify line 28 like this:
>> <xf:bind id="file" nodeset="file" type="xs:anyURI"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
>>
>> But I have the same error.
>
>>> [...]
>>>
>>> I fired upload action and I had an error in the log: 2008-11-12
>>> 10:05:22,447 ERROR ProcessorService  - Exception at
>>> oxf:/apps/test/xslt/transform.xsl (executing XSLT transformation)
>>> org.orbeon.oxf.common.OXFException: Undeclared prefix in xsi:type:
>>> xs at
>>>
org.orbeon.oxf.processor.serializer.BinaryTextContentHandler.startElement(Bi
>>> naryTextContentHandler.java:124)
>>> at
>>>
org.orbeon.oxf.xml.SimpleForwardingContentHandler.startElement(SimpleForward
>>> ingContentHandler.java:69)
>>> at
>>>
org.orbeon.oxf.processor.transformer.xslt.XSLTTransformer$3.startElement(XSL

>>> TTransformer.java:267)
>>> [...]
>
> i'm no xstl expert, but the error occurs when the xslt transformation
> is executed - so you maybe have to add a namespace for xs to the xsl
> stylesheet, too.
>
> HTH
> florian
>
>
--
View this message in context:
http://www.nabble.com/xslt-processor-in-xpl-action-tp20463859p20481060.html
Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: Re: RE: xslt processor in xpl action

MarcinKula
I added this code:

<xf:model id="model" schema="/apps/test/test.xsd">
    [...]
   <xf:bind id="b-boolean" nodeset="ts:Client/ts:Choice" type="xs:boolean"/>
    [...]
</xf:model>

<body>
  [...]
  <xf:input id="i-boolean" ref="ts:Client/ts:Choice"/>       
  [...]
</body>
                       
and modify all other files (xml, xsd)
Unluckily I have the same error.

Hmm... maybe my method of using xslt in the xpl file is wrong ?

I attached my all files in a zip archive.
test.zip

-Marcin

Steve Bayliss wrote
Yes, sounds like a bug.

Try adding a dummy xs:something element in your model somewhere - maybe that
will get the namespace prefix declaration to propagate, from reading the bug
report URL you posted it sounds like that could be the source of the
problem...  Maybe because the only usage of xs: is within an attribute
value, something somewhere is dropping the namespace declaration.

>
>>> [...]
>>>
>>> I fired upload action and I had an error in the log: 2008-11-12
>>> 10:05:22,447 ERROR ProcessorService  - Exception at
>>> oxf:/apps/test/xslt/transform.xsl (executing XSLT transformation)
>>> org.orbeon.oxf.common.OXFException: Undeclared prefix in xsi:type:
>>> xs at
>>>
org.orbeon.oxf.processor.serializer.BinaryTextContentHandler.startElement(Bi
>>> naryTextContentHandler.java:124)
>>> at
>>>
org.orbeon.oxf.xml.SimpleForwardingContentHandler.startElement(SimpleForward
>>> ingContentHandler.java:69)
>>> at
>>>
org.orbeon.oxf.processor.transformer.xslt.XSLTTransformer$3.startElement(XSL
>>> TTransformer.java:267)
>>> [...]
Reply | Threaded
Open this post in threaded view
|

RE: Re: RE: xslt processor in xpl action

MarcinKula
Hi,

Any ideas how can I use xslt in the xpl file (with upload action) ?

Otherwise maybe this problem should be reported as a bug.  

Regards,
Marcin

MarcinKula wrote
I added this code:

<xf:model id="model" schema="/apps/test/test.xsd">
    [...]
   <xf:bind id="b-boolean" nodeset="ts:Client/ts:Choice" type="xs:boolean"/>
    [...]
</xf:model>

<body>
  [...]
  <xf:input id="i-boolean" ref="ts:Client/ts:Choice"/>       
  [...]
</body>
                       
and modify all other files (xml, xsd)
Unluckily I have the same error.

Hmm... maybe my method of using xslt in the xpl file is wrong ?
Reply | Threaded
Open this post in threaded view
|

RE: RE: Re: RE: xslt processor in xpl action

Steve Bayliss
Hi Marcin

Looking at your files again, the error could be a red-herring.

A couple of points:

1) in your read-uri.xpl pipeline, you are forcing the content type to
application/octet-stream, but I presume your uploaded file is an XML
document?

This will result in the XML document being encapsulated in a <document>
node, as a binary document, see
http://www.orbeon.com/ops/doc/reference-formats for information on this

2) you are using oxf:http-serializer to serialise the output - this
processor expects input encoded in the <document> format as well - so you
need to take your output of the xslt, and use eg an oxf:xml-converter to
convert the xml output to a format suitable for serializing - see
http://www.orbeon.com/ops/doc/processors-converters for info

Regards
Steve

-----Original Message-----
From: MarcinKula [mailto:[hidden email]]
Sent: 18 November 2008 08:10
To: [hidden email]
Subject: [ops-users] RE: Re: RE: xslt processor in xpl action



Hi,

Any ideas how can I use xslt in the xpl file (with upload action) ?

Otherwise maybe this problem should be reported as a bug.  

Regards,
Marcin


MarcinKula wrote:

>
> I added this code:
>
> <xf:model id="model" schema="/apps/test/test.xsd">
>     [...]
>    <xf:bind id="b-boolean" nodeset="ts:Client/ts:Choice"
> type="xs:boolean"/>
>     [...]
> </xf:model>
>
> <body>
>   [...]
>   <xf:input id="i-boolean" ref="ts:Client/ts:Choice"/>
>   [...]
> </body>
>
> and modify all other files (xml, xsd)
> Unluckily I have the same error.
>
> Hmm... maybe my method of using xslt in the xpl file is wrong ?
>
--
View this message in context:
http://www.nabble.com/xslt-processor-in-xpl-action-tp20463859p20555085.html
Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: RE: Re: RE: xslt processor in xpl action

MarcinKula
Hi Steve,

I modified my code as you suggested.

It works well now.
Thank you for all Your help!

Regards
Marcin

Steve Bayliss wrote
Hi Marcin

Looking at your files again, the error could be a red-herring.

A couple of points:

1) in your read-uri.xpl pipeline, you are forcing the content type to
application/octet-stream, but I presume your uploaded file is an XML
document?

This will result in the XML document being encapsulated in a <document>
node, as a binary document, see
http://www.orbeon.com/ops/doc/reference-formats for information on this

2) you are using oxf:http-serializer to serialise the output - this
processor expects input encoded in the <document> format as well - so you
need to take your output of the xslt, and use eg an oxf:xml-converter to
convert the xml output to a format suitable for serializing - see
http://www.orbeon.com/ops/doc/processors-converters for info

Regards
Steve