[xsl] XHTML to XHTML transform

Subject: [xsl] XHTML to XHTML transform
From: "Jeffrey Moss" <jeff@xxxxxxxxxxxx>
Date: Fri, 2 Apr 2004 10:55:54 -0700
I want to create XHTML files and run them through some transforms to turn
things like this:

<BODY>
<BOX>
    <TITLE>Title</TITLE>
    Hello World
    <FOOTER>Footer</FOOTER>
</BOX>
</BODY>

Into this:

<BODY>
<DIV ID="box">
    <DIV ID="top">
        <DIV ID="topleft">
        <DIV ID="topright">
        <SPAN ID="title">Title</SPAN>
    </DIV>
    Hello World
    <DIV ID="bottom">
        <DIV ID="bottomleft">
        <DIV ID="bottomright">
        <SPAN ID="footer">Footer</SPAN>
    </DIV>
</DIV>
</BODY>

...using a one time build file, or one time XSL transform. I all standard
XHTML content to remain intact, even stuff inside the "footer" element, and
everything. I'm pretty sure this will require the <apply-templates /> tag
all over the place, which is fine.

I have tried a number of different approaches already. I played around with
the xmlns:xhtml namespace in my XSL file (not sure if I ever did this
correctly, I don't think I fully understand what namespaces do).

I tried XSL copy in my templates but there doesn't seem to be a way to say
"apply templates or else copy node and apply templates"

I also tried to define a template that matches "*" for any unmatched node,
and copy the element and parameters and then apply templates on the content.

I also played with the xsl:output tag to see if I could get that to do
something cool, but no.

Please help!

-Jeff

Current Thread