Actually I don't want resulting output to be in the XHTML namespace, I just want saxon to think that it is...

If the resulting output is in the correct namespace (I used the code you provided below) my <br> tags look like this

<br xmlns="http://www.w3.org/1999/xhtml" />

It does this even though there are ancestor elements in the output with the same xmlns attribute.

I think in this situation I'm just going to use the xml output method...

Thanks for your advice though.

/John

Michael Kay wrote:
If your source document has elements with local-name br in no namespace, and you want your result document to have elements with local-name br in the XHTML namespace, then you need to modify the elements to change their namespace. This can be done with a template rule of the form:
 
<xsl:template match="br">
  <xsl:element name="br" namespace="http://www.w3.org/1999/xhtml"/>
</xsl:template>
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of John McGowan
Sent: 06 September 2006 20:27
To: Mailing list for SAXON XSLT queries
Subject: [saxon] xhtml method and xhtml namespace

I have a follow up question from a previous post.

I noticed that using the output method xhtml was outputting <br></br> instead of <br/>  I did some searching and found the information below.  Michael's response below makes sense to me.

My application is taking small snippets of xhtml and combining them to make an xhtml form  how do i get those small snippets (that have no namespace declaration)  to be treated as xhtml by Saxon.  asking the author of those snippets to declare namespaces just for <br> tags is not an option.

I tried setting the xmlns="http://www.w3.org/1999/xhtml" attribute in the highest level xhtml element in my stylesheet, which happens to be <form>

This partially worked.  Any <br/> tags that were added to the stylesheet itself were treated appropriately when outputted.  However, in my source document, there are chunks of xhtml containing <br/> tags that are turning into <br></br>.

since the outputted document does have a proper namespace declaration, are we looking at a Saxon bug, or is there something else I have to do to get saxon to realize that I want that xml from the source doc treated as xhtml?

/John
The most likely explanation is that your <br> element is not in the XHTML namespace.
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Mark Gabriel
Sent: 03 July 2006 10:33
To: saxon-help@lists.sourceforge.net
Subject: [saxon] xhtml output

Hi all…

Not sure if I’m being silly here or what.

With Saxon 8 outputting XHTML I’m not getting what I expect with regards to empty elements.

A <br/> will output as <br></br> which it regarded by browsers as 2 brs.

The same seems to happen for <img/> <hr/> etc

With the output as XML I and getting what I would expect and for HTML I get no closing tag at all.

How do I get the correct output for what I want?

Thanks,

Mark G


Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________ saxon-help mailing list saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help

-- 


John McGowan
mcgowan@lynch2.com
P 847.608.6900 x 110
F 847.608.9501
    

------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________ saxon-help mailing list saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help

-- 


John McGowan
mcgowan@lynch2.com
P 847.608.6900 x 110
F 847.608.9501