On 10 May 2004, at 17:30, Andreas L. Delmelle wrote:
So, generally speaking, you won't need to use <![CDATA[...]]> unless
it is
*absolutely* necessary. A combination of CDATA and
disable-output-escaping
is hinting that they're both superfluous
Another purpose they serve is to trick the XSL processor into thinking
that
it is *not* outputting XML while it actually is...
Well thanks guys! Due to learning about {} and replacing all that
xsl:text crap I reduced my stylesheet from 18,705 to 15,196 bytes.
But I still have some CDATA and escaping going on. This occurs when
creating table rows:
<tr>...
<xsl:if test="position() != 1">
<xsl:text disable-output-escaping="yes"><![CDATA[<tr
class="]]></xsl:text>
<xsl:copy-of select="$planetbg"/>
<xsl:text disable-output-escaping="yes"><![CDATA[">]]></xsl:text>
</xsl:if>
...
<xsl:if test="position() != last()">
<xsl:text disable-output-escaping="yes"><![CDATA[</tr>]]></xsl:text>
</xsl:if>
...</tr>
It's designed to create new rows like this:
<tr>
<th rowspan="3">...</th>
<td>some data</td>
</tr>
<tr>
<td>more data</td>
</tr>
<tr>
<td>row 3 of the header</td>
</td>
But outputting nodes within an xml:if and closing them within another
causes parse errors in Libxslt and Sablotron.
<xsl:attribute name="href">
<xsl:value-of select="concat('#',@cite)" />
<xsl:number count="/catalogue/citation[@author=id(@cite)/@author and
@year=id(@cite)/@year]" format="a"/>
</xsl:attribute>
<xsl:number> doesn't work for me. I tried putting it in a variable and
outputting the variable as a test and nothing was produced.
nor was anything output by David's
<xsl:number format="a"
count="reference[@author=current()/@author][@year=current()/@year]"/>
or by changing " and " to "][" in Andreas' version.
The key approach from Michael Key didn't seem to work from just copying
and pasting, but I will read the docs on keys and see if i can fix it.
I'm using Libxslt and Sablotron - Saxon and Xalan-J cannot parse the
xsl file properly, so I am not bothering with them. I don't know what
versions I have, whichever ones are bundled with Marc Liyanage's
TestXSLT 3.0 software (http://www.entropy.ch/software/macosx/)
If you want to take a look at everything, these are the URLs:
http://astro.nickshanks.com/library/extrasolar.en.html > HTML after
processing
http://astro.nickshanks.com/library/extrasolar.xml
http://astro.nickshanks.com/stylesheets/extrasolar.xsl
http://astro.nickshanks.com/dtds/extrasolar.dtd
- Nick.