472,950 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,950 software developers and data experts.

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
Jul 18 '05 #1
1 1866
uc**@ogbuji.net (Uche Ogbuji) wrote in message news:<d1**************************@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
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sergio del Amo | last post by:
Hi, I use the xslt functions provided by php. I am running in my computer the package xampp(www.apachefriends.org) which includes php/apache/mysql .. In this package the php includes the sablotron...
2
by: Doug Farrell | last post by:
Hi all, I'm trying to build a demonstration website using mod_python and 4Suite to show how we could transform XML documents into HTML with XSLT. Here is a piece of code that causes it to blow...
8
by: Ola Natvig | last post by:
Anybody out there who knows if the 4suite implementation of XSLT are a threadsafe one? -- -------------------------------------- Ola Natvig <ola.natvig@infosense.no> infoSense AS / development
6
by: Ramon M. Felciano | last post by:
Helo all -- I'm trying to gain a deeper understand for what type of semi-declarative programming can be done through XML and XPath/XSLT. I'm looking at graph processing problems as a testbed for...
4
by: Ringo Langly | last post by:
Hi all, I'm a seasoned web programmer, but I've never touched XSLT. It's always been one of those acronyms I've never needed to educate myself on. Now... we're working with a web content...
1
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP...
2
by: Elmo Mäntynen | last post by:
I was wondering about the differences with the referred libs and servers. Since the documentation isn't so thorough(and a bit because of my laziness), I thought I'd make request for usage accounts...
4
by: Asbjørn Ulsberg | last post by:
Sorry for posting to a lot of groups, but I'm not sure what this problem relates to, so I thought it was better to be safe than sorry. Please feel free to set FUT to the proper group when...
10
by: daz_oldham | last post by:
Hi I am doing an XSLT that processes (for example) a list of hotels. Each hotel has the attribute @StarRating which is one of the following values: * ** *** ****
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.