Subject: [xsl] Error batch processing XML with XSLT 2.0 From: "Mark Peters" <flickrmeister@xxxxxxxxx> Date: Mon, 10 Mar 2008 15:17:04 -0400 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Having a stylesheet proce, Florent Georges | Thread | Re: [xsl] Error batch processing XM, Florent Georges |
Re: [xsl] Having a stylesheet proce, Florent Georges | Date | Re: [xsl] Error batch processing XM, Florent Georges |
Month |