Subject: Re: Unwanted elements in xsl output
From: "Rudi Starcevic" <rudi@xxxxxxxxxxxx>
Date: Wed, 9 Jul 2003 21:29:41 +1000
|
Hi,
Sorry, there are two typing errors in my email request.
They are only in this email not in my code.
In my style sheet below I have:
mlns:xsl="http://www.w3.org/1999/XSL/Transform">
( missing the 'x' )
In my xmls:w style sheet below I have the xsl:template for 'address'
without a 'w:' prefix.
<xsl:template match="address">
I'll did double check but will in future triple check.
Apologies - I don't want to waste anyone's time.
Kind regards
Rudi.
> Hi,
>
> I'm sending an xml packet direct to both Mozilla and IE web browers
> and the results are almost what I'm after.
> The xml and xsl files are below.
>
> Essentially after processing the xml packet and xsl style sheet
> the templates are executed correctly but still those elements
> not matched in my xsl:templates still appear.
>
> For example the output should be an html table with 3 rows:
>
> name:Wwnames
> URL:http://www.wwnames.com
> URL:http://www.ozdot.com
>
> This is correct.
> However in the xml packet there is one other element, language,
> which still appears.
>
> In Mozilla it looks like
>
> name:Wwnames
> URL:http://www.wwnames.com
> URL:http://www.ozdot.com
> PHP
>
> and in IE it's the other way around:
>
> PHP
> name:Wwnames
> URL:http://www.wwnames.com
> URL:http://www.ozdot.com
>
> I've been using xmlns:w in other trials but the results are the same.
> I'll also include my xmlns:w files below.
>
> At this stage I'm only using web browsers but I plan on using
> the Sablotron xsl processor for server side processing. I haven't
> tried these files with Sablotron yet only the browsers.
>
> How can I stop the unmatched elements from appearing ?
> I think the answer is in the namespace.
>
> Thanks
> Kind regards
> Rudi.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet type="text/xsl" href="webapps.xsl"?>
> <webapps>
> <website name="Wwnames">
> <address>http://www.wwnames.com</address>
> <address>http://www.ozdot.com</address>
> <language>PHP</language>
> </website>
> </webapps>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0" mlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:template match="/">
> <html>
> <head><title>Web app. list</title></head>
> <body>
> <xsl:for-each select="webapps/website">
> <table border="1" summary="Web Application Table">
> <tr>
> <td>Site Name:</td>
> <td><xsl:value-of select="@name"/></td>
> </tr>
> <xsl:apply-templates/>
> </table>
> </xsl:for-each>
> </body>
> </html>
> </xsl:template>
>
> <xsl:template match="address">
> <tr>
> <td>URL:</td>
> <td><xsl:value-of select="."/></td>
> </tr>
> </xsl:template>
>
> </xsl:stylesheet>
>
> File with xmlns:w
>
> <?xml version="1.0" encoding="UTF-8"?>
> <?xml-stylesheet type="text/xsl" href="webapps.xsl"?>
> <w:webapps xmlns:w="http://www.rudistarcevic.com">
> <w:website name="Wwnames">
> <w:address>http://www.wwnames.com</w:address>
> <w:address>http://www.ozdot.com</w:address>
> <w:language>PHP</w:language>
> </w:website>
> </w:webapps>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:w="http://www.rudistarcevic.com">
>
> <xsl:template match="/">
> <html>
> <head><title>Web app. list</title></head>
> <body>
> <xsl:for-each select="w:webapps/w:website">
> <table border="1" summary="Web Application Table">
> <tr>
> <td>Site Name:</td>
> <td><xsl:value-of select="@name"/></td>
> </tr>
> <xsl:apply-templates/>
> </table>
> </xsl:for-each>
> </body>
> </html>
> </xsl:template>
>
> <xsl:template match="address">
> <tr>
> <td>URL:</td>
> <td><xsl:value-of select="."/></td>
> </tr>
> </xsl:template>
>
> </xsl:stylesheet>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|