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 May 11th, 2009, 06:56 AM
Authorized User
 
Join Date: Dec 2005
Posts: 71
Thanks: 10
Thanked 0 Times in 0 Posts
Default Cals table to Html table XSLT

Dear All,

I am looking for a XSLT to include into my current XSL for conversion of cals table to html table set.

I tried using following link: which result with following errors.

http://www.biglist.com/lists/xsl-lis.../msg00666.html

Error Message:
SystemID: file.xsl
Location: 205:0
Description: XPath syntax error at char 69 on line 205 in {...pec[@colname=$namest]/@col ...}:
Unexpected token name "num" beyond end of expression
URL: http://www.w3.org/TR/xpath20/#ERRXPST0003


Any help would be appreciable.
__________________
Thanks,
Rocxy.
 
Old May 11th, 2009, 07:04 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

I think the post you copied the XSLT from has unwanted line breaks so change lines like
Code:
    <xsl:variable name="colst"
select="ancestor::*[colspec/@colname=$namest]/colspec[@colname=$namest]/@col
num"/>
    <xsl:variable name="colend"
select="ancestor::*[colspec/@colname=$nameend]/colspec[@colname=$nameend]/@c
olnum"/>
to
Code:
    <xsl:variable name="colst"
select="ancestor::*[colspec/@colname=$namest]/colspec[@colname=$namest]/@colnum"/>
    <xsl:variable name="colend"
select="ancestor::*[colspec/@colname=$nameend]/colspec[@colname=$nameend]/@colnum"/>
and the errors should go away.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
roozy (July 13th, 2010)
 
Old May 12th, 2009, 06:04 AM
Authorized User
 
Join Date: Dec 2005
Posts: 71
Thanks: 10
Thanked 0 Times in 0 Posts
Default

Dear Martin,

Thank U so much - Working fine.
__________________
Thanks,
Rocxy.
 
Old July 13th, 2010, 11:30 AM
Registered User
 
Join Date: Jul 2010
Posts: 2
Thanks: 3
Thanked 0 Times in 0 Posts
Red face

Dear ROCXY/ Martin,

I'm an XSLT newbie an have an urgent need to transform CALS tables to XHTML, So I used the XSLT discussed above. However, I don't know what is it that I'm doing wrong cuz when I transfer a table like:

Code:
<article xmlns='http://docbook.org/ns/docbook'>
        <tgroup cols='5' align='left' colsep='1' rowsep='1'>
            <colspec colname='c1'/>
            <colspec colname='c2'/>
            <colspec colname='c3'/>
            <colspec colnum='5' colname='c5'/>
            <thead>
                <row>
                    <entry namest="c1" nameend="c2" align="center">Horizontal Span</entry>
                    <entry>a3</entry>
                    <entry>a4</entry>
                    <entry>a5</entry>
                </row>
            </thead>
            <tfoot>
                <row>
                    <entry>f1</entry>
                    <entry>f2</entry>
                    <entry>f3</entry>
                    <entry>f4</entry>
                    <entry>f5</entry>
                </row>
            </tfoot>
            <tbody>
                <row>
                    <entry>b1</entry>
                    <entry>b2</entry>
                    <entry>b3</entry>
                    <entry>b4</entry>
                    <entry morerows='1' valign='middle'><para>Vertical Span</para></entry>
                </row>
                <row>
                    <entry>c1</entry>
                    <entry namest="c2" nameend="c3" align='center' morerows='1' valign='bottom'>Span Both</entry>
                    <entry>c4</entry>
                </row>
                <row>
                    <entry>d1</entry>
                    <entry>d4</entry>
                    <entry>d5</entry>
                </row>
            </tbody>
        </tgroup>
</article>
I get this:

Code:
    
        Sample CALS Table
            
                
                    Horizontal Span
                    a3
                    a4
                    a5
                
                    f1
                    f2
                    f3
                    f4
                    f5
                
                    b1
                    b2
                    b3
                    b4
                    Vertical Span
                
                
                    c1
                    Span Both
                    c4
                
                
                    d1
                    d4
                    d5
where I was expecting to get the equivalent XHTML table. I'd appreciate if you could help me out and I apologize in advance if I'm doing something really stupid

Roozy
 
Old July 13th, 2010, 11:38 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I would guess a namespace issue. Check that the XSLT code is looking for elements in the namespace where your instance has them.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
The Following User Says Thank You to mhkay For This Useful Post:
roozy (July 13th, 2010)
 
Old July 13th, 2010, 11:42 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

If you use an XSLT 2.0 processor like Saxon or AltovaXML tools then I think that stylesheet you are trying to use could be easily adapted by using
version="2.0"
and
xpath-default-namespace="http://docbook.org/ns/docbook"
on the xsl:stylesheet element.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
roozy (July 13th, 2010)
 
Old July 13th, 2010, 11:56 AM
Registered User
 
Join Date: Jul 2010
Posts: 2
Thanks: 3
Thanked 0 Times in 0 Posts
Default


its always the namespace issue, isn't it ?

Thanks allot guys,





Similar Threads
Thread Thread Starter Forum Replies Last Post
very urgent:cals table to indesign table using xsl franklinclinton XSLT 1 December 16th, 2009 03:48 PM
CALS to HTML Transformation RussellKay XSLT 1 May 11th, 2009 06:46 AM
hiding and showing the table in html through xslt nachiketha XSLT 6 March 16th, 2007 01:12 AM
constructing a HTML table from xml data using xslt rameshnarayan XSLT 0 September 19th, 2005 06:53 AM
size of table (type table is table of number) MikoMax Oracle 1 November 19th, 2003 03:11 AM





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