[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Error batch processing XML with XSLT 2.0

Subject: Error batch processing XML with XSLT 2.0
From: "Mark Peters" <flickrmeister@xxxxxxxxx>
Date: Mon, 10 Mar 2008 15:17:04 -0400
 Error batch processing XML with XSLT 2.0
Hi,

I'm attempting to replicate the exercises in an article published on
IBM's developerWorks site, called, "Batch processing XML with XSLT
2.0" (http://www.ibm.com/developerworks/xml/library/x-tipbatc.html).
The article explains how to generate a directory list using the
HTML/XML Directory List Generator (HDLG) tool, and then use the
directory list as the input for a transformation. The HDLG tool is
easy to understand. I created a couple of XML files in an empty
directory. The files match the sample files described in the article.

For example:

test1.xml:

<?xml version="1.0" encoding="UTF-8"?>
<testrun run="test1">
    <test name="foo" pass="true" />
    <test name="bar" pass="true" />
    <test name="baz" pass="true" />
</testrun>


Here is the output from the HDLG tool. My output resembles the author's output.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hdlg:filesystem SYSTEM "http://www.hdlg.info/XML/filesystem.dtd">
<hdlg:filesystem xmlns:hdlg="http://www.hdlg.info/XML/filesystem">
   <hdlg:folder name="temp" url="file:/C:/temp/">
      <hdlg:file name="test1.xml" size="184" type="unknown"
url="file:/C:/temp/test1.xml">
      </hdlg:file>
      <hdlg:file name="test2.xml" size="184" type="unknown"
url="file:/C:/temp/test2.xml">
      </hdlg:file>
   </hdlg:folder>
</hdlg:filesystem>


And here is the stylesheet, copied from the article:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"  indent="no"/>
<xsl:template match="/">
     <xsl:for-each select="//*:file">
          <xsl:variable select="document(@url)" name="contents" />
          <xsl:value-of select="$contents/testrun/@run" />
          <xsl:text>
          </xsl:text>
     </xsl:for-each>
</xsl:template>
</xsl:stylesheet>


When I apply the stylesheet against my HDLG output file, Saxon 6.5.5
displays the following error:

Error at xsl:for-each on line 7 of file:/C:/sabadoc/xsl/HDLG.xsl:
  Invalid character (:) in expression //*:file
Transformation failed: Failed to compile stylesheet. 1 error detected.


I've tried changing the XPATH in the for-each statement to
"//hdlg:file" and adding an XMLNS attribute
(xmlns:hdlg="http://www.hdlg.info/XML/filesystem.dtd"). Saxon
completed the transformation, but the output file was empty. I've been
Googling the error and reading more information about namespaces in
the archives, but think I'm traveling the wrong path.

Any idea why this transformation is bombing?

Thanks,
Mark

-- 

Mark Peters
Senior Technical Writer
Saba Software

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.