xsl-list
[Top] [All Lists]

Re: [xsl] Re: xhtml via xslt failure

2013-12-17 12:43:55
On 17/12/2013, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
On 17/12/2013 17:08, e-letter wrote:
Don't understand, seems nested:

It is nested (unless you cut and pasted the wrong thing)

You have one xsl:template element inside another. The stylesheet should
not compile, and you should get no output.


Compilation occurred, so this is probably due to the processing
environment (jedit). Anyway, the nested element was removed:

<xsl:stylesheet
        version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns='http://www.w3.org/1999/xhtml'
        >
        <xsl:import href="xqueryexampledata.xml"/>
        <xsl:output
                method="xml"
                doctype-public="-//W3C//DTD XHTML Basic 1.1//EN"
                
doctype-system="http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd";
                encoding="utf-8"
                indent="no"
                omit-xml-declaration="yes"
                media-type="text/xml"
                standalone="yes"
                version="1.1"
                />
        <xsl:template
                match='/'
                >
                <html xmlns='http://www.w3.org/1999/xhtml' lang='en' 
xml:lang='en'>
                        <head>
                                <meta
                                        name='notice' content='xhtml document 
created by xml transformation' />
                                <title>Test output web page</title>
                        </head>
                        <body>
                                <xsl:apply-templates
                                        select='*'
                                        />
                        </body>
                </html>
        </xsl:template>
        <xsl:template
                match="bookstore/book"
                >
                <p>
                        <xsl:if
                                test="following-sibling::author">
                                 and
                        </xsl:if>
                        <xsl:apply-templates
                                select='author'
                                />
                </p>
                        </xsl:template>
</xsl:stylesheet>

The transformation result:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en"
lang="en"><head><meta content="xhtml document created by xml
transformation" name="notice" /><title>Test output web
page</title></head><body>
        <p>Giada De Laurentiis</p>
        <p>J K. Rowling</p>
        <p>James McGovernPer BothnerKurt CagleJames LinnVaidyanathan 
Nagarajan</p>
        <p>Erik T. Ray</p>
</body></html>

The xml file has authors in two positions to consider, single authors
as child elements of 'book' and as multiple sibling elements of the
parent 'book' (i.e. each author is a separate child element), so it
seems that the suggestion to use element attribute
'test="following-sibling::author"' is not applicable.

Back to reading the specifications :)

--~------------------------------------------------------------------
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>
--~--