Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xsl] XHTML to XHTML transform

From: "Andreas L. Delmelle" <a_l.delmelle@---------->
To:
Date: 4/2/2004 8:41:00 AM
> -----Original Message-----
> From: Jeffrey Moss [mailto:jeff@xxxxxxxxxxxx]
>
<snip />
> 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).
>

Hi,

What exactly is it that is not working?

If your supplied source and desired target format were plain XML the
solution would look like:

<xsl:template match="BODY">
  <xsl:copy>
    <xsl:apply-templates />
  </xsl:copy>
</xsl:template>

<xsl:template match="BOX">
  <DIV ID="box">
    <xsl:apply-templates />
  </DIV>
</xsl:template>

<xsl:template match="TITLE">
  <DIV ID="top">
    <DIV ID="topleft" />
    <DIV ID="topright" />
    <SPAN ID="title">
      <xsl:apply-templates />
    </SPAN>
  </DIV>
</xsl:template>

<xsl:template match="FOOTER">
  <DIV ID="bottom">
    <DIV ID="bottomleft" />
    <DIV ID="bottomright" />
    <SPAN ID="footer">
      <xsl:apply-templates />
    </SPAN>
  </DIV>
</xsl:template>

If you really want to you could combine the latter two templates, since they
output something very similar. The 'Hello World' text will be copied because
of the default template rule for text-nodes (same as the content of the
TITLE / FOOTER nodes)

Now, depending upon your source files (prefixed elements / namespaces), you
may need to make it something like:

<xsl:template match="html:BODY">
or
<xsl:template match="*[local-name()='BODY']">

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

In XSLT 1.0 the options are: xml / text / html

As you want to ouput XHTML, if you use xsl:output, you need to specify XML
as your output target.

Hope this helps!

Cheers,

Andreas


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent