You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kirk Storer <ba...@yahoo.com> on 2004/05/17 19:45:03 UTC

xslt ignore attributes

I am including an xhtml document in my page using the
following which works fine with a plain old <html>
tag.
<xsl:copy-of select="html/body/*"/>

However, if the html tag contains an xmlns attribute
it doesn't work. How can I get the xslt to reconize
the html tag even though it has attributes.

Thanks, 
Kirk Storer


	
		
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: xslt ignore attributes

Posted by Kirk Storer <ba...@yahoo.com>.
Thanks, that worked.


	
		
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: xslt ignore attributes

Posted by Upayavira <uv...@upaya.co.uk>.
Kirk Storer wrote:

>How do I do that when the html tag contains 4
>different xmlns attribute?
>
><html xmlns="http://www.w3.org/1999/xhtml"
>xmlns:dc="http://purl.org/dc/elements/1.1/"
>xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml">
>  
>
Only the xmlns= one matters.

So:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xhtml="http://www.w3.org/1999/xhtml">

<xsl:template match="xhtml:html/xhtml:body/xhtml/*">
  blah
</xsl:template>
...

Upayavira



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: xslt ignore attributes

Posted by Askild Aaberg Olsen <as...@xangeli.com>.
> -----Original Message-----
> From: Kirk Storer [mailto:backsstock@yahoo.com] 

> How do I do that when the html tag contains 4
> different xmlns attribute?
> 
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:dc="http://purl.org/dc/elements/1.1/"
> xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
>  xmlns:xhtml="http://www.w3.org/1999/xhtml">

The html-element has a default namespace declaration
(xmlns="http://www.w3.org/1999/xhtml").
You can rewrite this as follows:

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

which is equal to the previous declaration.

I also recommend to read up on your XML/XSLT-skills, especially the
namespace part:

http://www.dpawson.co.uk/xsl/sect2/sect21.html

Regards, Askild
-


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: xslt ignore attributes

Posted by Kirk Storer <ba...@yahoo.com>.
How do I do that when the html tag contains 4
different xmlns attribute?

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml">


	
		
__________________________________
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.
http://promo.yahoo.com/sbc/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: xslt ignore attributes

Posted by Upayavira <uv...@upaya.co.uk>.
Kirk Storer wrote:

>I am including an xhtml document in my page using the
>following which works fine with a plain old <html>
>tag.
><xsl:copy-of select="html/body/*"/>
>  
>However, if the html tag contains an xmlns attribute
>it doesn't work. How can I get the xslt to reconize
>the html tag even though it has attributes.
>  
>

Declare a namespace in your XSLT, such as xhtml.

Then do <xsl:copy-of select="xhtml:html/xhtml:body/*"/>

Should do it, I think.

Upayavira, who is delighted that the engineers working busily somewhere 
in West London have restored his internet connection.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: xslt ignore attributes

Posted by "Volkm@r" <pl...@arcor.de>.
Joerg Heinicke wrote:
> On 18.05.2004 14:11, Volkm@r wrote:
> 
>> <xsl:copy-of select="*[local-name()='html']/*[local-name()='body']/*"/>
>>
>> This works without any further declaration of namespaces.
> 
> 
> But me understands this as an ugly hack working around the capabilities 
> and restrictions of XML.

It doesn't look very pretty, I know. But it seems to be the easiest way 
to avoid copying unwanted namespaces to the output.

-- 
volkm@r


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: xslt ignore attributes

Posted by Joerg Heinicke <jo...@gmx.de>.
On 18.05.2004 14:11, Volkm@r wrote:

> <xsl:copy-of select="*[local-name()='html']/*[local-name()='body']/*"/>
> 
> This works without any further declaration of namespaces.

But me understands this as an ugly hack working around the capabilities 
and restrictions of XML.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: xslt ignore attributes

Posted by "Volkm@r" <pl...@arcor.de>.
Kirk Storer wrote:
> I am including an xhtml document in my page using the
> following which works fine with a plain old <html>
> tag.
> <xsl:copy-of select="html/body/*"/>
> 
> However, if the html tag contains an xmlns attribute
> it doesn't work. How can I get the xslt to reconize
> the html tag even though it has attributes.

<xsl:copy-of select="*[local-name()='html']/*[local-name()='body']/*"/>

This works without any further declaration of namespaces.

-- 
HTH
Volkm@r


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org