[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] commenting an XML element [XSLT 1.0][xsltproc]


Subject: Re: [xsl] commenting an XML element [XSLT 1.0][xsltproc]
From: pankaj.c@xxxxxxxxxxxxxxxxxx
Date: Wed, 18 Aug 2010 18:04:51 +0530

Thanks everybody for your thoughts.
Martin, just for the brevity below is the snippet of my sample xml, which 
is a table and <spec/> is actually is <colspec/> (copy pasted from the 
wrong snippet earlier)

<?xml version="1.0" encoding="UTF-8"?>
<!-- New document created with EditiX at Wed Aug 18 17:37:11 IST 2010 -->
<table id="t0010" frame="topbot" rowsep="0" colsep="0">
<label>Table 3-1</label>
<caption>
<simple-para id="sp0200" role="title">This is a dummy title.</simple-para>
<simple-para id="sp0210">Ranjan</simple-para>
</caption>
<source>Source if present.</source>
<tgroup cols="2">
<colspec colname="col1"/>
<colspec colname="col2"/>
<thead valign="top">
<row>
<entry rowsep="1" align="left">Abbreviation</entry>
<entry rowsep="1" align="left">Dosage Interval</entry>
</row>
</thead>
<!-- More code here 
-->
</tgroup>
</table>

Stylesheet snippet is same as posted earlier and  I just tried using 
"XALAN" in editix2010sp1 and got the following error. 

Error:
==================================
No character data is allowed between top-level elements
No character data is allowed between top-level elements
No character data is allowed between top-level elements
No character data is allowed between top-level elements

Failed to compile stylesheet. 4 errors detected.

If I select the first error it highlights line
<entry rowsep="1" align="left">Dosage Interval</entry>

I am not sure but possibly my processing of entry element in stylesheet is 
causing problem, which looks like below:

<xsl:template match="table//entry">
        <xsl:copy>
        <xsl:attribute name="table_type">cell</xsl:attribute>
        <xsl:choose>
                <xsl:when test="name(ancestor::*)='thead'">
                        <xsl:attribute name="theader"/>  
                        <xsl:attribute 
name="cellstyle">thead_cell</xsl:attribute>
                        <xsl:attribute name="valign">top</xsl:attribute>
                </xsl:when>
        </xsl:choose>
        <xsl:copy-of select="@*"/>
        <xsl:apply-templates/>
        </xsl:copy>
 
</xsl:template>

Any thoughts please.

Please let me know if the snippets are not enough to understand the issue.

Best,
Pankaj


Current Thread
Keywords
xml