This is the mail archive of the mailing list .

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Newbie: Excel XML XSL

Thanks Thomas. It works great. Have successfully beeen
able to extract other data also. I wouldn't have made 
it without your help.


Thomas B. Passin  (13.2.2002  17:35):
>This can definitely be confusing.  Here is how to sort it out for your
>First, the top level element contains a default namespace:
>This is also the namespace declared for the "ss" prefix.
>Second, the element that contains the element you are interested in, itself
>has a default naemspace:
><DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
>So the Workbook element is in the
>"urn:schemas-microsoft-com:office:spreadsheet" namespace, which is the same
>as the "ss" namespace, and the Document Properties element is in the
>"urn:schemas-microsoft-com:office:office namespace.  Furthermore, the
>element is in the default namespace of its parent element (since it does
>have a prefix).
>To find these elements in an xpath expression, you have to use their
>namespace, which you do by using a prefix bound to it.  But there is no
>prefix for the default namespace in the xml source document, so what do you
>do?  Simple, just supply your own in the stylesheet.  The prefixes you use
>do n0t have to match those used in the source document, because the xslt
>processor uses the actual namespaces, not their prefixes, to perform
>For instance, let's use "oo" for the office:office one, and "ss" for the
>office:spreadsheet one:
><xsl:stylesheet version="1.0"
>Now the path to your Author element is:
>Author: <xsl:value-of
>By test, this does extract the value of the Author, giving:
>Author: Paul Cornell
>Tom p
>[Matts Isuls]
>> I'm a total newbie and have problems with an Excel XP (2002) XML file.
>> Below you see a first XSL test of mine.
>> I only want to display the author. The HTML displays fine (IE6)
>> but not the Author form the XML file.
>> I get real confused with all the XML namespace stuff.
>> Any  help is appreciated.
>> -XSL-----------------------------------
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <xsl:stylesheet version="1.0"
>> xmlns:xsl="";>
>> <xsl:output indent="yes"/>
>> <xsl:template match="/">
>> <html><head><title>Excel worksheet</title>
>> </head><body>
>> <h1>Excel worksheet</h1>
>> Author: <xsl:value-of select="Workbook/DocumentProperties/Author"/>
>> </body></html>
>> </xsl:template>
>> </xsl:stylesheet>
>> -/XSL-----------------------------------
>> -XML-----------------------------------
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <?xml-stylesheet type="text/xsl" href="book2.xsl"?>
>> <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="";>
>>     <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
>>         <Author>Paul Cornell</Author>
>>         <LastAuthor>Paul Cornell</LastAuthor>
>>         <Created>2001-08-02T16:08:21Z</Created>
>>         <Company>Microsoft Corporation</Company>
>>         <Version>10.2625</Version>
>>     </DocumentProperties>
>>     <OfficeDocumentSettings
>>         <DownloadComponents/>
>>         <LocationOfComponents HRef="file:///\\OfficeXP\CD1\"/>
>>     </OfficeDocumentSettings>
>>     <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
>>         <WindowHeight>6135</WindowHeight>
>>         <WindowWidth>8445</WindowWidth>
>>         <WindowTopX>240</WindowTopX>
>>         <WindowTopY>120</WindowTopY>
>>         <ProtectStructure>False</ProtectStructure>
>>         <ProtectWindows>False</ProtectWindows>
>>     </ExcelWorkbook>
>>     <Styles>
>>         <Style ss:ID="Default" ss:Name="Normal">
>>             <Alignment ss:Vertical="Bottom"/>
>>             <Borders/>
>>             <Font/>
>>             <Interior/>
>>             <NumberFormat/>
>>             <Protection/>
>>         </Style>
>>     </Styles>
>> <!-- ** snip ** -->
>> </Workbook>
>> -/XML-----------------------------------
> XSL-List info and archive:

 XSL-List info and archive:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]