Subject:XSLT and Saxon Author:Tom Patterson Date:23 Sep 2004 11:26 AM
I'm a newbie here, only been doing this for about a day or so, so please excuse any ignorance on my part. I am trying to create an XSLT using multiple style sheets for modularized code and multiple xml documents. I have no problem including the xsl documents or the xml documents, but I am having issues trying to use counters. The <xsl:count> element doesn't seem to work properly because the xml document is in multiple files and I can't just use a regular variable because xslt won't let you change them after they have been assigned. So this is what I'm attempting:<br>
<br>
I have <xsl:variable name="p0ct" saxon:assignable="yes" select="0"/> as the global declaration for this variable. Then later I have:<br>
<br>
...<br>
<saxon:assign name="p0ct" select="$p0ct + 1"/><br>
...<br>
<br>
When I run this using the built-in processor with Stylus Studio, instead of updating the variable, it just outputs this in the resulting html document. In the stylesheet declaration, I have<br>
<br>
xmlns:saxon="<a href="http://saxon.sf.net"">">http://saxon.sf.net"</a> extension-element-prefixes="saxon"<br>
<br>
I put this in all the stylesheets that have anything to do with saxon, but they don't seem to do anything. I tried changing to the builtin saxon processor, but then I don't get anything for the output. I'm kinda lost as to what to try next. Any ideas?
Subject:XSLT and Saxon Author:Tony Lavinio Date:23 Sep 2004 03:08 PM
First, since saxon:assignable is a Saxon-specific extension, it will be
ignored by any non-Saxon processors, including the internal one.
You didn't say whether you were using Saxon 6.5.x or Saxon 7.x or
Saxon 8.0, but looking at the documentation at http://www.saxonica.com/documentation/extensions/attributes.html
for saxon:assignable says nothing about having to set
extension-element-prefixes, so just removing that may solve your
problem.
Subject:XSLT and Saxon Author:Tom Patterson Date:23 Sep 2004 04:38 PM
The version of Stylus Studio I am using comes with a version 6 saxon (it says is internal) and a version 7 saxon (it says is external and won't allow debugging.) If I try to run it with the processor labelled "built-in", then the transformation is completed, but it spits out the saxon elements as if they were html. If I try to use any of the other processors that come with Stylus Studio, they all crash and say that it is an unknown element. Is there another way to have variables that can be changed? I can't use the number of position functions built into xsl because the elements I need to enumerate all exist in different files. I'm am open to any suggestions any may have.
Subject:XSLT and Saxon Author:Tony Lavinio Date:23 Sep 2004 06:26 PM
You did not state if removing the extension-element-prefixes
attributes solved the problem.
Otherwise, for support of Saxon-specific attributes, you're
going to have to pursue this on the Saxon-specific mailing
list.
However, generally, there are ways to handle enumeration that
do not require changing a variable. Perhaps if you posted
your documents, we might be better able to help.
Another good reference for doing things like this is the "XSLT
Cookbook" by Sal Mangago, ISBN 0596003722.
Subject:XSLT and Saxon Author:Tom Patterson Date:24 Sep 2004 09:48 AM Originally Posted: 24 Sep 2004 09:46 AM
Oops. Sorry. No, it didn't fix it. Here are a couple of thie files I'm working with. Sometimes I think that just a flat file would make things easier. Thanks a lot. This is driving me nuts.
Subject:XSLT and Saxon Author:Ivan Pedruzzi Date:29 Sep 2004 10:36 AM
You forgot to attach figuretom.xsl and tabtomle.xsl
we can't run your sample.
I don't see the need of saxon:assign
$p0ct in only used in the paratom.xsl and never re-assign,
sp1ct could be handled adding some logic rather then using an extension.
Subject:XSLT and Saxon Author:Tom Patterson Date:29 Sep 2004 12:02 PM
Wow, I am on the ball today. Besides forgetting the files, I took out the code in paratom.xsl. The para0 template should be:
<xsl:template match="para0">
<saxon:assign name="p0ct" select="$p0ct + 1"/>
<xsl:if test="@id!=''">
<a name="{@id}"/>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
I tried just using a count, but it kept resetting the counter because of the multiple files.
Subject:XSLT and Saxon Author:Tony Lavinio Date:30 Sep 2004 04:23 PM
Again, questions regarding processor-specific extensions
should be posted to a forum specific to that processor.
Michael Kay himself is active on the saxon-list at http://sourceforge.net/forum/forum.php?forum_id=94027