xsl-list
[Top] [All Lists]

[xsl] Re: xhtml via xslt failure

2013-12-16 14:38:37
On 15/12/2013, e-letter <inpost(_at_)gmail(_dot_)com> wrote:

    An xml stylesheet was created:


This was edited to:

<!--
<xsl:template match="/bookstore">
        <html lang="en" xml:lang="en">
                <head>
                        <meta name="note" content="xhtml document created by 
xml transformation" />
                        <title>Test output web page</title>
                </head>
                <body>
                        <xsl:apply-templates select="book/author"/>
                </body>
        </html>
</xsl:template>
<xsl:template match="author">
        <p><xsl:value-of select="./text()"/></p>
</xsl:template>-->
<xsl:stylesheet
        version="2.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        >
        <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 xmlns='http://www.w3.org/1999/xhtml'>
                                <xsl:apply-templates
                                        select='./author'
                                        />
                                <!--<xsl:value-of select="./author"/>-->
                        </p>
        </xsl:template>
</xsl:stylesheet>

The resultant xhtml file:

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

According to the specification the above transformation can be
achieved using either element 'apply-templates' or element 'value-of'.

Why is it that when the element 'value-of' in the stylesheet above is
substituted for the element 'apply-templates', the result is a
truncation of the third line in the xhtml file, i.e. to:

...
<p>James McGovern</p>
...

Also, it it possible to add whitespace  and punctuation to the xhtml output, eg.

...
<p>James McGovern, Per Bothner, Kurt Cagle, James Linn, Vaidyanathan
Nagarajan</p>
...

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