This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Different outputs when i change namespace in an xml
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 19 Mar 2002 14:40:57 -0000
- Subject: RE: [xsl] Different outputs when i change namespace in an xml
- Reply-to: xsl-list at lists dot mulberrytech dot com
> 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?
Because your elements are then in a completely different namespace so they
will match completely different patterns and XPath expressions.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
>
> 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
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list