xsl-list
[Top] [All Lists]

transforming xhtml question

2003-03-23 16:14:07
Hello,

I'm doing transformations to some XHTML documents. Basically I need to only 
remove a few attributes and elements from them and leave the document largely 
intact beyond that.

I'm having problems navigating to the html elment and other elements when I 
leave the Doctype and namespace at the top of the xhtml doc.  I assume I'm 
missing something in my xpath syntax but for the life of me I can't figure out 
what.

Here's essentially my template

<xsl:template match="/">
    <xsl:apply-templates select="//html"/>
    <xsl:apply-templates select="//head"/>
</xsl:template>

<xsl:template match="html">
<!-- do stuff here -->
</xsl:template>
<xsl:template match="head">
<!-- do stuff here -->
</xsl:template>

Transforming this document doesn't work with the above ( it never selects my 
html head templates )

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<html xmlns="http://www.w3.org/1999/xhtml";>
<head><title>page title</title></head>
<body>
page body<br />
</body>
</html>

Transforming this document works as expected

<?xml version="1.0"?>
<html>
<head><title>page title</title></head>
<body>
page body<br />
</body>
</html>

It's my understanding that the root element in each document is still html yes?

p.s.
I've been looking for some kind of XPATH tool that will let me see how a 
document tree is represented in XPATH syntax. If anyone knows of such a tool 
could you post a link?  

Thanks
Tyrone


__________________________________________________________________
Try AOL and get 1045 hours FREE for 45 days!
http://free.aol.com/tryaolfree/index.adp?375380

Get AOL Instant Messenger 5.1 for FREE! Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promos=380455

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>