Subject: Re: [xsl] Default namespace matching From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 29 Dec 2006 13:33:07 -0500 |
I think I must be misunderstanding something fundamental about namespaces. Is it not the case that if your source file has a default namespace, in order to get the stylesheet to match, all you have to do is include the same namespace in the declaration?
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"> <!-- pull in structure --> <xsl:template match="ss:Workbook">
Good luck, Wendell
My stylesheet works fine if I delete the xmlns declaration on both files - can someone please tell me how to make it work without any modification? I've been stuck on this for ages....any help appreciated!
Cheers, Ed
Please see below.
Here is my source file.
<?xml version="1.0"?> <?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> .... </Workbook>
Here is part of my stylesheet.
<xsl:stylesheet version="1.0" xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"> <!-- pull in structure --> <xsl:template match="//Workbook"> <mapping>
<xsl:for-each select="Worksheet"> <xsl:apply-templates select="."/> </xsl:for-each> </mapping> </xsl:template>
<xsl:template match="Worksheet[@ss:Name='Zone']"> <xsl:for-each select="Table/Row"> <xsl:apply-templates select="Cell[1]/Data[@ss:Type='String']" mode="zone"/> </xsl:for-each> </xsl:template> </xsl:stylesheet>
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Default namespace matchin, Michael Kay | Thread | [xsl] Re: Cosmetic sorting, Dimitre Novatchev |
Re: [xsl] Managing cross references, Wendell Piez | Date | RE: [xsl] Processing inner elements, cknell |
Month |