xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Different results on different server


Subject: Re: [xsl] Different results on different server
From: Joelle Tegwen <tegwe002@xxxxxxx>
Date: Wed, 07 Oct 2009 14:56:15 -0500

My use of . in the key is probably due to not *really* understanding how it works. I'll remember your advice about using keys for future development. Thanks.

I changed my stylesheet to
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" verion="4.0" omit-xml-declaration="yes" encoding="iso-8859-1" indent="yes"/> <xsl:key name="project" match="project" use="."/>
<xsl:key name="project_id" match="project" use="@project_id"/>
<xsl:variable name="projects"
select="//project[generate-id() = generate-id(key('project', .))]"/>
<xsl:variable name="projects_id"
select="//project[generate-id() = generate-id(key('project_id', @project_id))]"/>
<xsl:template match="/staff">
<xsl:comment><xsl:value-of select="system-property('xsl:vendor')"/></xsl:comment> <xsl:value-of select="count($projects)"/><xsl:text> - </xsl:text>
<xsl:value-of
select="count(//project[generate-id() = generate-id(key('project', .))])"/><xsl:text> - </xsl:text>
<xsl:value-of select="count($projects_id)"/><xsl:text> - </xsl:text>
<xsl:value-of
select="count(//project[generate-id() = generate-id(key('project_id', @project_id))])"/>
</xsl:template>
</xsl:transform>


(to test your thought that it might be the key).

Dev:
<!--libxslt-->5 - 5 - 5 - 5

Test <!--libxslt-->0 - 5 - 0 - 5

Does this help?

Thanks
J
Add somewhere in your stylesheet:

<xsl:comment><xsl:value-of
select="system-property('xsl:vendor')"/></xsl:comment>

and please report what the two processors say.

Given that the project element is:

        <project project_id="5">
         <title>Separated Project</title>
         <acronym></acronym>
         <project_type> Project</project_type>
         <short_desc>This project is separated</short_desc>
        </project>

it's very odd to use "." (the string value of the project element) as the
key. It should work in theory, but it's sufficiently odd that this is
probably where the bug lies. I would have expected to see something like
use="@project_id".

Regards,

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


Current Thread
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor