4Suite and XSLT problems

Discussion in 'Python' started by Doug Farrell, Aug 5, 2003.

  1. Doug Farrell

    Doug Farrell Guest

    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, Aug 5, 2003
    #1
    1. Advertising

  2. Doug Farrell

    Doug Farrell Guest

    Doug Farrell, Aug 12, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    714
    Stylus Studio
    Aug 3, 2004
  2. Doug Farrell

    Problem with mod_python and 4Suite

    Doug Farrell, Aug 8, 2003, in forum: Python
    Replies:
    2
    Views:
    353
    Doug Farrell
    Aug 12, 2003
  3. Ola Natvig

    4suite XSLT thread safe ?

    Ola Natvig, Jan 26, 2005, in forum: Python
    Replies:
    8
    Views:
    443
    Uche Ogbuji
    Jan 28, 2005
  4. =?iso-8859-1?q?Elmo_M=E4ntynen?=

    Differences between RDFlib - 4RDF and Redfoot - 4Suite?

    =?iso-8859-1?q?Elmo_M=E4ntynen?=, Jul 14, 2005, in forum: Python
    Replies:
    2
    Views:
    293
    =?iso-8859-1?q?Elmo_M=E4ntynen?=
    Jul 19, 2005
  5. Sullivan WxPyQtKinter

    Berkeley DB XML vs 4suite for fast searching in XML DB?

    Sullivan WxPyQtKinter, Apr 1, 2006, in forum: Python
    Replies:
    1
    Views:
    314
    Ravi Teja
    Apr 2, 2006
Loading...

Share This Page