Namespace question

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

Namespace question

Martin Mohnhaupt
Hello everyone !

I want to mix xhtml and svg to produce reports. To do this, I use an oxf:xslt  and a stylesheet like this:

    <p:processor name="oxf:xslt"> 
        <!-- <p:input name="config" href="../xsl/compile2xhtml.xsl"/> -->
        <p:input name="config"> 
            <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                <xsl:import href="../xsl/compile2xhtml.xsl"/> 
            </xsl:stylesheet> 
        </p:input>       
        <p:input name="data" href="#query-results"/>
        <p:output name="html-data" ref="data"/> 
    </p:processor>


The sylesheet looks like this:

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
         <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml">
            <xhtml:head/>
                <xhtml:body>
                    <xhtml:h1>XSL Version <xsl:value-of select="system-property('xsl:version')"/></xhtml:h1>
                    <xhtml:h2>XSL Vendor <xsl:value-of select="system-property('xsl:vendor')"/></xhtml:h2>
                    The SVG part starts below
                    <xhtml:hr/>
             
                    <!-- Test svg -->
                    <svg:svg xmlns:svg="http://www.w3.org/2000/svg" version="1.1" width="400" height="300">
                        <!-- un petit rectangle avec des coins arroundis  -->
                        <svg:rect x="50" y="50" rx="5" ry="5" width="300" height="100" style="fill:#CCCCFF;stroke:#000099"/>
                        <!-- un texte au meme endroit -->
                        <svg:text x="55" y="90" style="stroke:#000099;fill:#000099;font-size:24;">
                            HELLO cher visiteur
                        </svg:text>
                    </svg:svg>

                    <xhtml:hr/>
                    The SVG part ended above
                </xhtml:body>
         </xhtml:html>    
    </xsl:template>
</xsl:stylesheet>

Unfortunately, this is the html I get (n the browser, no SVG is displayed, grrr):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <link rel="stylesheet" href="/35M1/config/theme/orbeon.css" type="text/css">
  <title>XSL Version 2.0</title>
  <meta name="generator" content="Orbeon Forms 3.5.M1.200701122128">
 </head>
 <body>
  <h1>XSL Version 2.0</h1>
  <h2>XSL Vendor SAXON 8.7 from Saxonica</h2>
  The SVG part starts below
  
  <hr>
  <svg:svg version="1.1" width="400" height="300">
   <svg:rect x="50" y="50" rx="5" ry="5" width="300" height="100" style="fill:#CCCCFF;stroke:#000099"></svg:rect>
   <svg:text x="55" y="90" style="stroke:#000099;fill:#000099;font-size:24;">
    HELLO cher visiteur 
    
   </svg:text>
  </svg:svg>
  <hr>
  The SVG part ended above
  
 </body>
</html>

What am I doing wrong ?  As usual, any help is much appreciated !

Martin


-- 
Martin Mohnhaupt
Nice Data Systems
Rue de Lyon 42 - CH 1203 GENEVE
Tél: +41 (0) 22 344 11 39
Mob: +41 (0) 78 636 00 75
Email: [hidden email]
Web: http://www.nicedata.com
Skype: martin.mohnhaupt
Action Carbone: http://www.actioncarbone.org


--
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: Namespace question

Erik Bruchez
Administrator
Martin,

 > I want to mix xhtml and svg to produce reports. To do this, I use an
 > oxf:xslt  and a stylesheet like this:

 > Unfortunately, this is the html I get (n the browser, no SVG is
 > displayed, grrr):
 >
 > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 > <html>
 >  <head>
 >   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 >   <link rel="stylesheet" href="/35M1/config/theme/orbeon.css"
type="text/css">
 >   <title>XSL Version 2.0</title>
 >   <meta name="generator" content="Orbeon Forms 3.5.M1.200701122128">
 >  </head>
 >  <body>
 >
 >   <h1>XSL Version 2.0</h1>
 >   <h2>XSL Vendor SAXON 8.7 from Saxonica</h2>
 >   The SVG part starts below
 >
 >   <hr>
 >   <svg:svg version="1.1" width="400" height="300">
 >    <svg:rect x="50" y="50" rx="5" ry="5" width="300" height="100"
style="fill:#CCCCFF;stroke:#000099"></svg:rect>
 >    <svg:text x="55" y="90"
style="stroke:#000099;fill:#000099;font-size:24;">
 >     HELLO cher visiteur
 >
 >    </svg:text>
 >
 >   </svg:svg>
 >   <hr>
 >   The SVG part ended above
 >
 >  </body>
 > </html>
 >
 > What am I doing wrong ?  As usual, any help is much appreciated !

HTML does not support namespaces. You have to produce XHTML
instead. Look at epilogue-servlet.xpl: there is a section there you
can uncomment to produce XHTML.

-Erik

--
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: Namespace question

Martin Mohnhaupt
Thanks Erik !

I uncommented the mentioned section and it works for some pages. But not for the output produced by my simple xslt transformation.
Having serialized the  output of the oxf:request processor, i see that there is no /request/headers/header[name = 'accept'] value...
Since in the epilogue servlet, there is a check on "<p:when test="contains(/request/headers/header[name = 'accept'], 'application/xhtml+xml')">", the result is negative...

I am getting confused on what to do :-)

Martin

Erik Bruchez wrote:
Martin,

> I want to mix xhtml and svg to produce reports. To do this, I use an
> oxf:xslt  and a stylesheet like this:

> Unfortunately, this is the html I get (n the browser, no SVG is
> displayed, grrr):
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
>  <head>
>   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>   <link rel="stylesheet" href="/35M1/config/theme/orbeon.css" type="text/css">
>   <title>XSL Version 2.0</title>
>   <meta name="generator" content="Orbeon Forms 3.5.M1.200701122128">
>  </head>
>  <body>
>
>   <h1>XSL Version 2.0</h1>
>   <h2>XSL Vendor SAXON 8.7 from Saxonica</h2>
>   The SVG part starts below
>
>   <hr>
>   <svg:svg version="1.1" width="400" height="300">
>    <svg:rect x="50" y="50" rx="5" ry="5" width="300" height="100" style="fill:#CCCCFF;stroke:#000099"></svg:rect>
>    <svg:text x="55" y="90" style="stroke:#000099;fill:#000099;font-size:24;">
>     HELLO cher visiteur
>
>    </svg:text>
>
>   </svg:svg>
>   <hr>
>   The SVG part ended above
>
>  </body>
> </html>
>
> What am I doing wrong ?  As usual, any help is much appreciated !

HTML does not support namespaces. You have to produce XHTML
instead. Look at epilogue-servlet.xpl: there is a section there you
can uncomment to produce XHTML.

-Erik


-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

-- 
Martin Mohnhaupt
Nice Data Systems
Rue de Lyon 42 - CH 1203 GENEVE
Tél: +41 (0) 22 344 11 39
Mob: +41 (0) 78 636 00 75
Email: [hidden email]
Web: http://www.nicedata.com
Skype: martin.mohnhaupt
Action Carbone: http://www.actioncarbone.org


--
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: Namespace question

Erik Bruchez
Administrator
Martin,

Right, the epilogue tests on the accept header so as to send XHTML only
to browsers that explicitly say they support it. But you can try to
remove this test and always send XHTML. Mozilla-based browsers like
Firefox are supposed to send the accept header.

BTW I am not sure what browser you are targeting, or how IE handles SVG
with plugins, but you may have to customize the epilogue more to make
things work.

-Erik

Martin Mohnhaupt wrote:

> Thanks Erik !
>
> I uncommented the mentioned section and it works for some pages. But not
> for the output produced by my simple xslt transformation.
> Having serialized the  output of the oxf:request processor, i see that
> there is no /request/headers/header[name = 'accept'] value...
> Since in the epilogue servlet, there is a check on "<p:when
> test="contains(/request/headers/header[name = 'accept'],
> 'application/xhtml+xml')">", the result is negative...
>
> I am getting confused on what to do :-)
>
> Martin
>
> Erik Bruchez wrote:
>> Martin,
>>
>> > I want to mix xhtml and svg to produce reports. To do this, I use an
>> > oxf:xslt  and a stylesheet like this:
>>
>> > Unfortunately, this is the html I get (n the browser, no SVG is
>> > displayed, grrr):
>> >
>> > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
>> > <html>
>> >  <head>
>> >   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>> >   <link rel="stylesheet" href="/35M1/config/theme/orbeon.css"
>> type="text/css">
>> >   <title>XSL Version 2.0</title>
>> >   <meta name="generator" content="Orbeon Forms 3.5.M1.200701122128">
>> >  </head>
>> >  <body>
>> >
>> >   <h1>XSL Version 2.0</h1>
>> >   <h2>XSL Vendor SAXON 8.7 from Saxonica</h2>
>> >   The SVG part starts below
>> >
>> >   <hr>
>> >   <svg:svg version="1.1" width="400" height="300">
>> >    <svg:rect x="50" y="50" rx="5" ry="5" width="300" height="100"
>> style="fill:#CCCCFF;stroke:#000099"></svg:rect>
>> >    <svg:text x="55" y="90"
>> style="stroke:#000099;fill:#000099;font-size:24;">
>> >     HELLO cher visiteur
>> >
>> >    </svg:text>
>> >
>> >   </svg:svg>
>> >   <hr>
>> >   The SVG part ended above
>> >
>> >  </body>
>> > </html>
>> >
>> > What am I doing wrong ?  As usual, any help is much appreciated !
>>
>> HTML does not support namespaces. You have to produce XHTML
>> instead. Look at epilogue-servlet.xpl: there is a section there you
>> can uncomment to produce XHTML.
>>
>> -Erik
>>
>> ------------------------------------------------------------------------
>>
>>
>> --
>> 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
>>  
>
> --
> Martin Mohnhaupt
> Nice Data Systems
> Rue de Lyon 42 - CH 1203 GENEVE
> Tél: +41 (0) 22 344 11 39
> Mob: +41 (0) 78 636 00 75
> Email: [hidden email]
> Web: http://www.nicedata.com
> Skype: martin.mohnhaupt
> Action Carbone: http://www.actioncarbone.org
>
>
> ------------------------------------------------------------------------
>
>
> --
> 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: Namespace question

Martin Mohnhaupt
Erik,

I came to a similar solution...

I just added an oxf:xslt processor that processes the oxf:request output and adds the possibly missing header....

Thank you very much for your help!

Martin

Erik Bruchez wrote:
Martin,

Right, the epilogue tests on the accept header so as to send XHTML only to browsers that explicitly say they support it. But you can try to remove this test and always send XHTML. Mozilla-based browsers like Firefox are supposed to send the accept header.

BTW I am not sure what browser you are targeting, or how IE handles SVG with plugins, but you may have to customize the epilogue more to make things work.

-Erik

Martin Mohnhaupt wrote:
Thanks Erik !

I uncommented the mentioned section and it works for some pages. But not for the output produced by my simple xslt transformation.
Having serialized the  output of the oxf:request processor, i see that there is no /request/headers/header[name = 'accept'] value...
Since in the epilogue servlet, there is a check on "<p:when test="contains(/request/headers/header[name = 'accept'], 'application/xhtml+xml')">", the result is negative...

I am getting confused on what to do :-)

Martin

Erik Bruchez wrote:
Martin,

> I want to mix xhtml and svg to produce reports. To do this, I use an
> oxf:xslt  and a stylesheet like this:

> Unfortunately, this is the html I get (n the browser, no SVG is
> displayed, grrr):
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
>  <head>
>   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
>   <link rel="stylesheet" href="/35M1/config/theme/orbeon.css" type="text/css">
>   <title>XSL Version 2.0</title>
>   <meta name="generator" content="Orbeon Forms 3.5.M1.200701122128">
>  </head>
>  <body>
>
>   <h1>XSL Version 2.0</h1>
>   <h2>XSL Vendor SAXON 8.7 from Saxonica</h2>
>   The SVG part starts below
>
>   <hr>
>   <svg:svg version="1.1" width="400" height="300">
>    <svg:rect x="50" y="50" rx="5" ry="5" width="300" height="100" style="fill:#CCCCFF;stroke:#000099"></svg:rect>
>    <svg:text x="55" y="90" style="stroke:#000099;fill:#000099;font-size:24;">
>     HELLO cher visiteur
>
>    </svg:text>
>
>   </svg:svg>
>   <hr>
>   The SVG part ended above
>
>  </body>
> </html>
>
> What am I doing wrong ?  As usual, any help is much appreciated !

HTML does not support namespaces. You have to produce XHTML
instead. Look at epilogue-servlet.xpl: there is a section there you
can uncomment to produce XHTML.

-Erik

------------------------------------------------------------------------


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
 

-- 
Martin Mohnhaupt
Nice Data Systems
Rue de Lyon 42 - CH 1203 GENEVE
Tél: +41 (0) 22 344 11 39
Mob: +41 (0) 78 636 00 75
Email: [hidden email]
Web: http://www.nicedata.com
Skype: martin.mohnhaupt
Action Carbone: http://www.actioncarbone.org


------------------------------------------------------------------------


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
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: [hidden email] For general help: [hidden email] ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

-- 
Martin Mohnhaupt
Nice Data Systems
Rue de Lyon 42 - CH 1203 GENEVE
Tél: +41 (0) 22 344 11 39
Mob: +41 (0) 78 636 00 75
Email: [hidden email]
Web: http://www.nicedata.com
Skype: martin.mohnhaupt
Action Carbone: http://www.actioncarbone.org


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