Bug in unparsed-text implementation?

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

Bug in unparsed-text implementation?

mjgraham
Hi,

I have a simple XPL that starts:
<p:config xmlns...>
  <p:param type="input" name="instance"/>
  <p:param type="output" name="data"/>
             
  <p:processor name="oxf:xslt">
    <p:input name="data" href="#instance"/>
    <p:input name="config">
      <xsl:stylesheet version="2.0" >
        <xsl:variable name="input" as="xs:string"
select="/form/file"/>        
        <xsl:variable name="input-text"
              as="xs:string"
              select="unparsed-text($input, 'iso-8859-1')"/>
...

where the input form is:

<form>
  <file/>
</form>

However, it appears as though the unparsed-text() function is throwing
an exception:

java.net.MalformedURLException: unknown protocol: oxf
        at java.net.URL.<init>(URL.java:574)
        at java.net.URL.<init>(URL.java:464)
        at java.net.URL.<init>(URL.java:413)
        at
org.orbeon.saxon.functions.UnparsedText.readFile(UnparsedText.java:115)
        at
org.orbeon.saxon.functions.UnparsedText.evaluateItem(UnparsedText.java:77)
        at
org.orbeon.saxon.expr.ComputedExpression.iterate(ComputedExpression.java:609)
        at
org.orbeon.saxon.expr.CardinalityChecker.iterate(CardinalityChecker.java:135)
        at
org.orbeon.saxon.expr.ExpressionTool.evaluate(ExpressionTool.java:369)
        at
org.orbeon.saxon.instruct.GlobalVariable.getSelectValue(GlobalVariable.java:180)
        at
org.orbeon.saxon.instruct.GlobalVariable.evaluateVariable(GlobalVariable.java:204)

The curious thing is that I am not adding "oxf:" to the URL, just
putting the file location in as the value of /form/file.

    Cheers,

    Matthew



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Bug in unparsed-text implementation?

Mike Leary
the processor's name attribute is oxf:xslt.  Check that the elided xmlns
in the config contains xmlns:oxf

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:oxf="http://www.orbeon.com/oxf/processors">


On Sat, Jan 13, 2007 at 11:49:31PM -0800, Matthew Graham wrote:
> Hi,
>
> I have a simple XPL that starts:
> <p:config xmlns...>
>  <p:param type="input" name="instance"/>
>  <p:param type="output" name="data"/>
>            
>  <p:processor name="oxf:xslt">
--



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Bug in unparsed-text implementation?

Erik Bruchez
Administrator
In reply to this post by mjgraham
Matthew,

As you can see from the stack trace, Saxon directly tries to read the
file. It doesn't go through our URI resolver, so we are unable to
intercept the "oxf:" URL and you get an error.

The solution would be to hook-up a URI resolver. From what I can see,
the Saxon 8.8 code does not support this at the moment.

BTW you get an "oxf:" protocol probably because your pipeline, which
serves as the base URI for the URI resolution in Saxon, is an "oxf:"
protocol.

What does the full URL of the file you are trying to load look like?

-Erik

Matthew Graham wrote:

> Hi,
>
> I have a simple XPL that starts:
> <p:config xmlns...>
>  <p:param type="input" name="instance"/>
>  <p:param type="output" name="data"/>
>              <p:processor name="oxf:xslt">
>    <p:input name="data" href="#instance"/>
>    <p:input name="config">
>      <xsl:stylesheet version="2.0" >
>        <xsl:variable name="input" as="xs:string"
> select="/form/file"/>               <xsl:variable name="input-text"
>              as="xs:string"
>              select="unparsed-text($input, 'iso-8859-1')"/>
> ...
>
> where the input form is:
>
> <form>
>  <file/>
> </form>
>
> However, it appears as though the unparsed-text() function is throwing
> an exception:
>
> java.net.MalformedURLException: unknown protocol: oxf
>        at java.net.URL.<init>(URL.java:574)
>        at java.net.URL.<init>(URL.java:464)
>        at java.net.URL.<init>(URL.java:413)
>        at
> org.orbeon.saxon.functions.UnparsedText.readFile(UnparsedText.java:115)
>        at
> org.orbeon.saxon.functions.UnparsedText.evaluateItem(UnparsedText.java:77)
>        at
> org.orbeon.saxon.expr.ComputedExpression.iterate(ComputedExpression.java:609)
>
>        at
> org.orbeon.saxon.expr.CardinalityChecker.iterate(CardinalityChecker.java:135)
>
>        at
> org.orbeon.saxon.expr.ExpressionTool.evaluate(ExpressionTool.java:369)
>        at
> org.orbeon.saxon.instruct.GlobalVariable.getSelectValue(GlobalVariable.java:180)
>
>        at
> org.orbeon.saxon.instruct.GlobalVariable.evaluateVariable(GlobalVariable.java:204)
>
>
> The curious thing is that I am not adding "oxf:" to the URL, just
> putting the file location in as the value of /form/file.
>
>    Cheers,
>
>    Matthew
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Bug in unparsed-text implementation?

Erik Bruchez
Administrator
In reply to this post by Mike Leary
Mike,

There are two different things here:

o The XML namespace prefix "oxf" mapped to the XML namespace URI
   http://www.orbeon.com/oxf/processors. This is used to resolve XML
   qualified names (also referred to as "QNames") such as
   "oxf:xslt". These are qualified names but not URLs and are
   constructs specific to XML.

o The "oxf" URL scheme used to address Orbeon Forms resources through
   the Orbeon Forms Resource Manager. These are part of URLs such as
   "oxf:/config/properties.xml".

Granted, it may be a little confusing to have both in the same file!
But while you have to use the "oxf" scheme to access Orbeon Forms
resources, you don't have to use the "oxf" prefix in XPL: you can use
any prefix you like. For example, you could do:

  <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
            xmlns:processor="http://www.orbeon.com/oxf/processors">

     <p:processor name="processor:xslt">
       ...

I am adding an entry to the FAQ as well.

-Erik

Mike Leary wrote:
 > the processor's name attribute is oxf:xslt.  Check that the elided xmlns
 > in the config contains xmlns:oxf
 >
 > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
 >           xmlns:oxf="http://www.orbeon.com/oxf/processors">
 >
 >
 > On Sat, Jan 13, 2007 at 11:49:31PM -0800, Matthew Graham wrote:
 >> Hi,
 >>
 >> I have a simple XPL that starts:
 >> <p:config xmlns...>
 >>  <p:param type="input" name="instance"/>
 >>  <p:param type="output" name="data"/>
 >>
 >>  <p:processor name="oxf:xslt">

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Bug in unparsed-text implementation?

mjgraham
Hi,

The namespace prefix oxf is already defined: the problem appears to be
that the argument of the XSLT function unparsed-text() is being
prepended with an oxf: prefix even when such a thing is not explicitly
defined in my XSLT.

    Cheers,

    Matthew

Erik Bruchez wrote:

> Mike,
>
> There are two different things here:
>
> o The XML namespace prefix "oxf" mapped to the XML namespace URI
>   http://www.orbeon.com/oxf/processors. This is used to resolve XML
>   qualified names (also referred to as "QNames") such as
>   "oxf:xslt". These are qualified names but not URLs and are
>   constructs specific to XML.
>
> o The "oxf" URL scheme used to address Orbeon Forms resources through
>   the Orbeon Forms Resource Manager. These are part of URLs such as
>   "oxf:/config/properties.xml".
>
> Granted, it may be a little confusing to have both in the same file!
> But while you have to use the "oxf" scheme to access Orbeon Forms
> resources, you don't have to use the "oxf" prefix in XPL: you can use
> any prefix you like. For example, you could do:
>
>  <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>            xmlns:processor="http://www.orbeon.com/oxf/processors">
>
>     <p:processor name="processor:xslt">
>       ...
>
> I am adding an entry to the FAQ as well.
>
> -Erik
>
> Mike Leary wrote:
> > the processor's name attribute is oxf:xslt.  Check that the elided
> xmlns
> > in the config contains xmlns:oxf
> >
> > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
> >           xmlns:oxf="http://www.orbeon.com/oxf/processors">
> >
> >
> > On Sat, Jan 13, 2007 at 11:49:31PM -0800, Matthew Graham wrote:
> >> Hi,
> >>
> >> I have a simple XPL that starts:
> >> <p:config xmlns...>
> >>  <p:param type="input" name="instance"/>
> >>  <p:param type="output" name="data"/>
> >>
> >>  <p:processor name="oxf:xslt">
>
> ------------------------------------------------------------------------
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  



--
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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Bug in unparsed-text implementation?

Erik Bruchez
Administrator
Matthew,

The issue has nothing to do with namespace prefixes, and everything to
do with URL resolution. I was not directly addressing your issue in my
answer below, just explaining the distinction between the two different
uses of "oxf:". Check my other response in the same thread.

-Erik

Matthew Graham wrote:

> Hi,
>
> The namespace prefix oxf is already defined: the problem appears to be
> that the argument of the XSLT function unparsed-text() is being
> prepended with an oxf: prefix even when such a thing is not explicitly
> defined in my XSLT.
>
>    Cheers,
>
>    Matthew
>
> Erik Bruchez wrote:
>> Mike,
>>
>> There are two different things here:
>>
>> o The XML namespace prefix "oxf" mapped to the XML namespace URI
>>   http://www.orbeon.com/oxf/processors. This is used to resolve XML
>>   qualified names (also referred to as "QNames") such as
>>   "oxf:xslt". These are qualified names but not URLs and are
>>   constructs specific to XML.
>>
>> o The "oxf" URL scheme used to address Orbeon Forms resources through
>>   the Orbeon Forms Resource Manager. These are part of URLs such as
>>   "oxf:/config/properties.xml".
>>
>> Granted, it may be a little confusing to have both in the same file!
>> But while you have to use the "oxf" scheme to access Orbeon Forms
>> resources, you don't have to use the "oxf" prefix in XPL: you can use
>> any prefix you like. For example, you could do:
>>
>>  <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>>            xmlns:processor="http://www.orbeon.com/oxf/processors">
>>
>>     <p:processor name="processor:xslt">
>>       ...
>>
>> I am adding an entry to the FAQ as well.
>>
>> -Erik
>>
>> Mike Leary wrote:
>> > the processor's name attribute is oxf:xslt.  Check that the elided
>> xmlns
>> > in the config contains xmlns:oxf
>> >
>> > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>> >           xmlns:oxf="http://www.orbeon.com/oxf/processors">
>> >
>> >
>> > On Sat, Jan 13, 2007 at 11:49:31PM -0800, Matthew Graham wrote:
>> >> Hi,
>> >>
>> >> I have a simple XPL that starts:
>> >> <p:config xmlns...>
>> >>  <p:param type="input" name="instance"/>
>> >>  <p:param type="output" name="data"/>
>> >>
>> >>  <p:processor name="oxf:xslt">
>>
>> ------------------------------------------------------------------------
>>
>>
>> --
>> 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
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>  
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Bug in unparsed-text implementation?

dynnamitt
I cannot find a good conclusion for this thread/question.
I also want to import text/plain xquery files. (Orbeon 3.6)

When using
<xsl:value-of select="unparsed-text('test.txt','utf-8')" />


..The error thrown is:
"java.net.MalformedURLException: unknown protocol: oxf"

But when using :
<xsl:value-of select="doc('test.txt')" />

..The file IS SUDDENLY FOUND (no protocol wining) and a (logical) error is thrown:
"Fatal error: Content is not allowed in prolog."

So , why isn't the unparsed-text() func working like the doc() func regarding uri-resolving ?

regards
Kjetil Dynnamitt

Erik Bruchez wrote
Matthew,

The issue has nothing to do with namespace prefixes, and everything to
do with URL resolution. I was not directly addressing your issue in my
answer below, just explaining the distinction between the two different
uses of "oxf:". Check my other response in the same thread.

-Erik

Matthew Graham wrote:
> Hi,
>
> The namespace prefix oxf is already defined: the problem appears to be
> that the argument of the XSLT function unparsed-text() is being
> prepended with an oxf: prefix even when such a thing is not explicitly
> defined in my XSLT.
>
>    Cheers,
>
>    Matthew
>
> Erik Bruchez wrote:
>> Mike,
>>
>> There are two different things here:
>>
>> o The XML namespace prefix "oxf" mapped to the XML namespace URI
>>   http://www.orbeon.com/oxf/processors. This is used to resolve XML
>>   qualified names (also referred to as "QNames") such as
>>   "oxf:xslt". These are qualified names but not URLs and are
>>   constructs specific to XML.
>>
>> o The "oxf" URL scheme used to address Orbeon Forms resources through
>>   the Orbeon Forms Resource Manager. These are part of URLs such as
>>   "oxf:/config/properties.xml".
>>
>> Granted, it may be a little confusing to have both in the same file!
>> But while you have to use the "oxf" scheme to access Orbeon Forms
>> resources, you don't have to use the "oxf" prefix in XPL: you can use
>> any prefix you like. For example, you could do:
>>
>>  <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>>            xmlns:processor="http://www.orbeon.com/oxf/processors">
>>
>>     <p:processor name="processor:xslt">
>>       ...
>>
>> I am adding an entry to the FAQ as well.
>>
>> -Erik
>>
>> Mike Leary wrote:
>> > the processor's name attribute is oxf:xslt.  Check that the elided
>> xmlns
>> > in the config contains xmlns:oxf
>> >
>> > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>> >           xmlns:oxf="http://www.orbeon.com/oxf/processors">
>> >
>> >
>> > On Sat, Jan 13, 2007 at 11:49:31PM -0800, Matthew Graham wrote:
>> >> Hi,
>> >>
>> >> I have a simple XPL that starts:
>> >> <p:config xmlns...>
>> >>  <p:param type="input" name="instance"/>
>> >>  <p:param type="output" name="data"/>
>> >>
>> >>  <p:processor name="oxf:xslt">
>>
>> ------------------------------------------------------------------------
>>
>>
>> --
>> You receive this message as a subscriber of the
>> ops-users@objectweb.org mailing list.
>> To unsubscribe: mailto:ops-users-unsubscribe@objectweb.org
>> For general help: mailto:sympa@objectweb.org?subject=help
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>  
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the ops-users@objectweb.org mailing list.
> To unsubscribe: mailto:ops-users-unsubscribe@objectweb.org
> For general help: mailto:sympa@objectweb.org?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the ops-users@objectweb.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@objectweb.org
For general help: mailto:sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Bug in unparsed-text implementation?

dynnamitt
ok, to answer my self here: There is a Bug :
http://forge.ow2.org/tracker/index.php?func=detail&aid=304936&group_id=168&atid=350207

K-)

dynnamitt wrote
I cannot find a good conclusion for this thread/question.
I also want to import text/plain xquery files. (Orbeon 3.6)

When using
<xsl:value-of select="unparsed-text('test.txt','utf-8')" />


..The error thrown is:
"java.net.MalformedURLException: unknown protocol: oxf"

But when using :
<xsl:value-of select="doc('test.txt')" />

..The file IS SUDDENLY FOUND (no protocol wining) and a (logical) error is thrown:
"Fatal error: Content is not allowed in prolog."

So , why isn't the unparsed-text() func working like the doc() func regarding uri-resolving ?

regards
Kjetil Dynnamitt

Erik Bruchez wrote
Matthew,

The issue has nothing to do with namespace prefixes, and everything to
do with URL resolution. I was not directly addressing your issue in my
answer below, just explaining the distinction between the two different
uses of "oxf:". Check my other response in the same thread.

-Erik

Matthew Graham wrote:
> Hi,
>
> The namespace prefix oxf is already defined: the problem appears to be
> that the argument of the XSLT function unparsed-text() is being
> prepended with an oxf: prefix even when such a thing is not explicitly
> defined in my XSLT.
>
>    Cheers,
>
>    Matthew
>
> Erik Bruchez wrote:
>> Mike,
>>
>> There are two different things here:
>>
>> o The XML namespace prefix "oxf" mapped to the XML namespace URI
>>   http://www.orbeon.com/oxf/processors. This is used to resolve XML
>>   qualified names (also referred to as "QNames") such as
>>   "oxf:xslt". These are qualified names but not URLs and are
>>   constructs specific to XML.
>>
>> o The "oxf" URL scheme used to address Orbeon Forms resources through
>>   the Orbeon Forms Resource Manager. These are part of URLs such as
>>   "oxf:/config/properties.xml".
>>
>> Granted, it may be a little confusing to have both in the same file!
>> But while you have to use the "oxf" scheme to access Orbeon Forms
>> resources, you don't have to use the "oxf" prefix in XPL: you can use
>> any prefix you like. For example, you could do:
>>
>>  <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>>            xmlns:processor="http://www.orbeon.com/oxf/processors">
>>
>>     <p:processor name="processor:xslt">
>>       ...
>>
>> I am adding an entry to the FAQ as well.
>>
>> -Erik
>>
>> Mike Leary wrote:
>> > the processor's name attribute is oxf:xslt.  Check that the elided
>> xmlns
>> > in the config contains xmlns:oxf
>> >
>> > <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>> >           xmlns:oxf="http://www.orbeon.com/oxf/processors">
>> >
>> >
>> > On Sat, Jan 13, 2007 at 11:49:31PM -0800, Matthew Graham wrote:
>> >> Hi,
>> >>
>> >> I have a simple XPL that starts:
>> >> <p:config xmlns...>
>> >>  <p:param type="input" name="instance"/>
>> >>  <p:param type="output" name="data"/>
>> >>
>> >>  <p:processor name="oxf:xslt">
>>
>> ------------------------------------------------------------------------
>>
>>
>> --
>> You receive this message as a subscriber of the
>> ops-users@objectweb.org mailing list.
>> To unsubscribe: mailto:ops-users-unsubscribe@objectweb.org
>> For general help: mailto:sympa@objectweb.org?subject=help
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>  
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the ops-users@objectweb.org mailing list.
> To unsubscribe: mailto:ops-users-unsubscribe@objectweb.org
> For general help: mailto:sympa@objectweb.org?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws


--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the ops-users@objectweb.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@objectweb.org
For general help: mailto:sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Bug in unparsed-text implementation?

Alessandro Vernet
Administrator
Kjetil,

dynnamitt wrote
Right, and doc() works, because Orbeon Forms handles this function specifically. Since you are already in a a pipeline, what I would do is to use the URL generator instead of XSLT and unparsed-text(). The URL generator allows you read a file as a text file and specify the encoding for that file. See:

http://www.orbeon.com/ops/doc/processors-generators-url

Alex