[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Unwanted elements in xsl output
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|