[xslt] Accessing RTFs from Python
- From: Norman Walsh <ndw nwalsh com>
- To: xslt gnome org
- Subject: [xslt] Accessing RTFs from Python
- Date: Fri, 14 Jun 2002 11:05:18 -0400
With the attached script and test files, running
python xslt.py test.xml test.xsl
prints:
called with nodeset:
colspec
called with nodeset:
I think it should print 'colgroup' in the second case.
xslt.py
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<article>
<articleinfo>
<title>Unit Test: table.001</title>
<releaseinfo role="CVS">$Id: table.001.xml,v 1.2 2002/01/18 21:06:45 nwalsh Exp $</releaseinfo>
<author><firstname>Norman</firstname><surname>Walsh</surname>
<affiliation><address><email>ndw@nwalsh.com</email></address></affiliation>
</author>
</articleinfo>
<table frame="all">
<title>TFoot Test</title>
<tgroup cols="2">
<colspec colwidth="2*"/>
<colspec colwidth="3*"/>
<tfoot>
<row>
<entry>Foot Left</entry>
<entry>Foot Right</entry>
</row>
</tfoot>
<tbody>
<row>
<entry>Body Left</entry>
<entry>Body Right</entry>
</row>
</tbody>
</tgroup>
</table>
</article>
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ptbl="http://nwalsh.com/xslt/ext/xsltproc/python/Table"
exclude-result-prefixes="ptbl"
version='1.0'>
<xsl:template match="tgroup">
<xsl:variable name="colgroup">
<colgroup>
<xsl:apply-templates select="colspec"/>
</colgroup>
</xsl:variable>
<xsl:variable name="foo" select="ptbl:adjustColumnWidths(colspec)"/>
<xsl:variable name="bar" select="ptbl:adjustColumnWidths($colgroup)"/>
</xsl:template>
<xsl:template match="colspec">
<colspec colwidth="{@colwidth}"/>
</xsl:template>
</xsl:stylesheet>
Be seeing you,
norm
--
Norman Walsh <ndw@nwalsh.com> | "I" before "E" except after "C":
http://nwalsh.com/ | simple, concise and efficeint.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]