Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 22nd, 2003, 02:55 AM
Registered User
 
Join Date: Jul 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default navigating MS Excel 2002

I'm having a few problems with the XSLT below. I am tring to associate the <Style> tag to <Cell> and thus apply the associated formatting info to the resultant <Entry>. This is for a CALS translation. I can't seem to get any more info from the source file once I implement this. In addition to which I am having to do all this after converting the source tags to upper case. Can anyone help?

############################

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="iso-8859-1" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:template match="/">
        <xsl:apply-templates/>
    </xsl:template>
    <xsl:template name="entry-format" match="WORKBOOK">
        <ROOT>
            <xsl:for-each select="/WORKBOOK/WORKSHEET/TABLE/ROW/CELL">
                            <xsl:variable name="span" select="@MERGEACROSS"/>


                <xsl:variable name="c" select="@STYLEID"/>

                <xsl:value-of select="CELL"/>
                <xsl:variable name="cell" select="."/>
                <!--CC>
                    <xsl:value-of select="$cell"/>
                    </CC!-->

                <xsl:for-each select="/WORKBOOK/STYLES/STYLE[@ID=$c]">
                <xsl:variable name="align" select="ALIGNMENT/@HORIZONTAL"/>

                    <xsl:variable name="v" select="@ID"/>

                    <ENTRY ALIGN="{$align}" SPAN="{$span}">
                        <xsl:value-of select="$cell"/>
                        <xsl:value-of select="."/>
                    </ENTRY>
                </xsl:for-each>
            </xsl:for-each>
        </ROOT>
    </xsl:template>
</xsl:stylesheet>

#####################################

Thanks

D.R

 
Old July 22nd, 2003, 04:19 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Without the source xml it's hard to say what's wrong but two points. Firstly why do you need to convert to uppercase, just change your paths to use lowercase?
Secondly your stylesheet does not have any of the namespace mappings that Excel normally has, these need to be included, usually in the xsl:stylesheet element.
If it's difficult to show the relevant portion of source xml and you're still having difficulties email a simple version as is possible to me off-list.

--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
Change the format of MS Excel Cells from MS Access hewstone999 Access VBA 0 March 7th, 2008 07:19 AM
Excel 2002 Sp1 & Excel Sp2 anup.bihani Excel VBA 0 November 23rd, 2006 04:48 AM
deploy ms commerce server 2002 projects dipankaronline Biztalk 0 April 19th, 2006 02:37 AM
Excel 2000 vs Excel 2002 Macro Issue williadn Excel VBA 1 July 14th, 2005 09:09 AM
Excel in win 2000 to excel winxp (excel 2002) Max Excel VBA 3 August 28th, 2003 04:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.