xsl-list
[Top] [All Lists]

RE: [xsl] Processing inner elements

2006-12-29 14:41:02
I asume you could use something like this

(the answer is seperate templates and "apply-templates")

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
    <xsl:template match="/">
        <html>
            <body>
                <xsl:apply-templates/>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="para">
        <p>
            <xsl:apply-templates/>
        </p>
    </xsl:template>

    <xsl:template match="break">
        <br />
    </xsl:template>

    <xsl:template match="image">
        <img src="{(_at_)src}"/>
    </xsl:template>
</xsl:stylesheet>

with apply-templates you pass the childnodes to the templates

cheers

Geert

At 21:38 29/12/2006, you wrote:
Please show us what the "obvious HTML" looks like.
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     Guy <guy(_at_)deltat1(_dot_)com>
Sent:     Fri, 29 Dec 2006 10:12:40 -0500
To:       <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject:  [xsl] Processing inner elements

This must be a trivial question but I cannot find any reference to the
standard way of processing this. Here is a fragment of XML:

<para>This is a sentence<break/>
        <image src=http://site.com/image/image.jpg/><break/>
        And a second sentence.
</para>

Assuming that you are at the <para> node, how does one typically transform
that into the obvious HTML that is required?

I know that a straight <xsl:value-of...> and <xsl:copy-of...> will not work.

Thanks!
Guy




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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