[xsl] Different outputs when i change namespace in an xml

Subject: [xsl] Different outputs when i change namespace in an xml
From: "Joeri Belis" <joeri.belis@xxxxxxxxxxxx>
Date: Tue, 19 Mar 2002 15:14:40 +0100
Hi,

Here is a stripped down version of excel xml. When i use the my test xsl on
the xml file, i only get the values
of the 2 data elemens of the cell ( 100 and "test" ). But when i remove
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
from the Workbook element in the input xml, i get a completely other output.
Why is this?

Joeri

input xml:

<?xml version="1.0"?>
<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";>

 <Worksheet ss:Name="Blad1">
  <Table ss:ExpandedColumnCount="6" ss:ExpandedRowCount="2"
x:FullColumns="1" x:FullRows="1">
   <Row>
    <Cell ss:Index="6">
     <Data ss:Type="Number">100</Data>
     <NamedCell ss:Name="OfferteNr"/>
    </Cell>
   </Row>
   <Row>
    <Cell ss:Index="6" ss:StyleID="s21">
     <Data ss:Type="String">test</Data>
    </Cell>
   </Row>
  </Table>
 </Worksheet>
</Workbook>

test xsl:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">

<xsl:output method="xml"
            indent="yes"/>

<xsl:template match="Workbook">
  <xsl:copy>
      <xsl:apply-templates select="*"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="*[ancestor::Workbook]">
  <xsl:copy>
    <xsl:apply-templates select="*"/>
  </xsl:copy>
</xsl:template>


</xsl:stylesheet>

output WITH xmlns="urn:schemas-microsoft-com:office:spreadsheet" in input
xml file

<?xml version="1.0" encoding="utf-8"?>





                                        100





                                        test

output WITHOUT xmlns="urn:schemas-microsoft-com:office:spreadsheet" in input
xml file

<?xml version="1.0" encoding="utf-8"?>
<Workbook xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas
-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsh
eet" xmlns:html="http://www.w3.org/TR/REC-html40";>
   <Worksheet>
      <Table>
         <Row>
            <Cell>
               <Data/>
               <NamedCell/>
            </Cell>
         </Row>
         <Row>
            <Cell>
               <Data/>
            </Cell>
         </Row>
      </Table>
   </Worksheet>
</Workbook>



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread