Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   4Suite and XSLT problems (http://www.velocityreviews.com/forums/t320602-4suite-and-xslt-problems.html)

Doug Farrell 08-05-2003 10:08 PM

4Suite and XSLT problems
 
Hi all,

I'm trying to use the 4Suite xml/xsl tools to transform some XML data
into HTML. I'm using some examples from the O'Reilly book "Python and
XML" and things are blowing up. Here is the little piece of code I'm
working on:

from xml.xslt.Processor import Processor

proc = Processor()

xsl = """<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html><body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Title</th>
<th align="left">Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body></html>
</xsl:template>
</xsl:stylesheet>
"""

# here comes the problem
proc.appendStylesheetString(xsl)


I'm not even getting to the transformation part, just trying to load
the xsl stylesheet. I've run the above xsl code, along with my xml
data though the command line 4xslt and it works fine. When I run the
line of Python code immediately above, I get a tracedump from Python
that looks like this:

Traceback (most recent call last):
File "/var/www/html/python/xslttest.py", line 44, in ?
proc.appendStylesheetString(xsl)
File "/usr/lib/python2.2/site-packages/_xmlplus/xslt/Processor.py",
line 124, in appendStylesheetString
sty = self._styReader.fromString(text, baseUri)
File "/usr/lib/python2.2/site-packages/_xmlplus/xslt/StylesheetReader.py",
line 570, in fromString
return pDomletteReader.PyExpatReader.fromString(self,st,
refUri='', ownerDoc=None, stripElements=None)
File "/usr/lib/python2.2/site-packages/Ft/Lib/ReaderBase.py", line
67, in fromString
rt = self.fromStream(stream, refUri, ownerDoc, stripElements)
File "/usr/lib/python2.2/site-packages/_xmlplus/xslt/StylesheetReader.py",
line 622, in fromStream
sheet.setup()
File "/usr/lib/python2.2/site-packages/_xmlplus/xslt/Stylesheet.py",
line 140, in setup
self._setupChildNodes()
File "/usr/lib/python2.2/site-packages/_xmlplus/xslt/Stylesheet.py",
line 183, in _setupChildNodes
curr_node.setup()
File "/usr/lib/python2.2/site-packages/_xmlplus/xslt/TemplateElement.py",
line 46, in setup
namespaces=self._nss
File "/usr/lib/python2.2/site-packages/_xmlplus/xpath/Util.py", line
83, in ExpandQName
split_name = (nss[prefix], local)
KeyError

I'm at a loss as to what to do and where to go from here. I'm running
Python 2.2.2 on a RedHat 9.0 system and I downloaded and installed
4Suite 1.0.* from www.4suite.org (though I don't think that was
necessary).

If anyone has some suggestions what I'm doing wrong, I'd very very
glad to hear them. Thanks in advance,

Doug Farrell

Doug Farrell 08-12-2003 12:19 PM

Re: 4Suite and XSLT problems
 
uche@ogbuji.net (Uche Ogbuji) wrote in message news:<d116fbae.0308081223.5c1da951@posting.google. com>...
>
> Your answers are here:
>
> http://uche.ogbuji.net/tech/akara/no...-01/basic-xslt
> http://www.xml.com/pub/a/2002/12/11/py-xml.html
>
> --Uche
> http://uche.ogbuji.net


Uche,

Thank you very much for the response, that is a big help to me and
I'll try and implement your suggestions. I'll post back here to let
you know of my success.

Again, thanks!
Doug


All times are GMT. The time now is 01:03 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.