Altova Mailing List Archives


RE: [xsl] Xpath and Ranges

From: "David White" <davidw@----------->
To:
Date: 8/4/2006 1:43:00 PM
Thanks for all the help guys!

I will supply my results as best I can:

I'm using a "cleanup" stylesheet to fix some bad XML (docbook)
Here is the cleanup.xsl's opening statements:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt="http://exslt.org/common"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date
xalan exslt msxsl">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"
doctype-system="C:\docbook\XML\docbookx.dtd"/>


Here is the template where I am trying to grab a set of nodes in order to wrap
them in a parent node (since this is docbook Im trying to wrap things in
sect1)

<xsl:template match="for $T1 in (//title)[1], $T2 in (//title)[2] return ($T1,
//*[. &gt;&gt; $T1 and . &lt;&lt; $T2])">
	<xsl:element name="sect1">
	<xsl:apply-templates/>
	</xsl:element>
</xsl:template>

I've installed Saxon 8.7.3N, and use XMLSpy with this commandline:
c:\saxon\Transform.exe -o %2 %1 %3

The error I get is:

XSLT Pattern syntax error at char 0 on line 83 (the template above),
In {for $}: Unexpected token in patter, found "for"
Failed to compile stylesheet, 1 error detected.

Hope that helps..let me know if I can supply any more information.

FYI the material Im apply this too is going to be open to the public (its
actually apart of the OGL, open gaming license).  So, Im trying to learn how
to apply XPATH.

Thanks!

David White

-----Original Message-----
From: Michael Kay [mailto:mike@xxxxxxxxxxxx]
Sent: Friday, August 04, 2006 8:35 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] Xpath and Ranges

>
> Could it be my software? XMLSpy 2006?
>

Does your xsl:stylesheet element specify version="2.0"? IIRC, XMLSpy invokes
a 2.0 processor when you specify version="2.0", and a 1.0 processor
otherwise.

Michael Kay
http://www.saxonica.com/

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.