[jcifs] XSLT

Michael B Allen mba2000 at ioplex.com
Mon May 24 00:49:32 GMT 2004


Any XSLT gurus out there?

I'm converting all jCIFS docs to use a very plain XSLT template so we can
style things nicer down the road. I want to isolate certain elements that
are possibly also HTML elements (e.g. TITLE) but allow all other elements
to just pass-through without being interpreted. How do I do that?

The only way I've found to do this just have a template that matches any
HTML element but is there a better more proper way?

Thanks,
Mike

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"
    encoding="ISO-8859-1"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>

<xsl:template match="topic">
    <HTML><HEAD>
    <STYLE TYPE="text/css">
        BODY {
            background-color: #ffffff;
            font-family: verdana, arial;
            font-size: small;
        }
    </STYLE>
    <TITLE></TITLE>
    </HEAD><BODY>

    <xsl:apply-templates/>

    </BODY></HTML>
</xsl:template>

<xsl:template match="title">
    <H2><xsl:apply-templates/></H2>
</xsl:template>

<xsl:template match=" a | abbr | acronym | address | applet | area |
        b | base | basefont | bdo | big | blockquote | body | br |
        button | caption | center | cite | code | col | colgroup |
        dd | del | dfn | dir | div | dl | dt | em | fieldset |
        font | form | frame | frameset | h1 | h2 | h3 | h4 | h5 | h6 |
        head | hr | html | i | iframe | img | input | ins | isindex |
        kbd | label | legend | li | link | map | menu | meta | noframes |
        noscript | object | ol | optgroup | option | p | param | pre | q |
        s | samp | script | select | small | span | strike | strong |
        style | sub | sup | table | tbody | td | textarea | tfoot | th |
        thead | tr | tt | u | ul | var">
    <xsl:copy>
        <xsl:copy-of select="@*"/>
        <xsl:apply-templates/>
    </xsl:copy>
</xsl:template>

</xsl:stylesheet>


More information about the jcifs mailing list