RE: [xsl] Different results on different server

Subject: RE: [xsl] Different results on different server
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 7 Oct 2009 17:44:06 +0100
> ok, so I have the stripped down documents and I've still got 
> the same problem. I think php uses Saxon 1.0 

Unlikely.

> (but I always forget how to check). 

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 

> 
> Thanks much for your help.
> Joelle
> 
> The result on my machine. This is the desired result.
> 
> 5 - 5
> Separated Project
> Final Project Creation Test
> Another New Empty Project
> National Center on Educational Outcomes
> Making the Connection: Engaging and Retaining Young Adults in 
> Postsecondary Education
> 
> The results on the test server. :
> 
> 0 - 5
> 
> 
> The xslt:
> <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:variable name="projects"
>         select="//project[generate-id() = 
> generate-id(key('project', .))]"/>
>    
>     <xsl:template match="/staff">
>        
>         <xsl:value-of select="count($projects)"/><xsl:text> - 
> </xsl:text>
>         <xsl:value-of
>             select="count(//project[generate-id() = 
> generate-id(key('project', .))])"/>
>         <xsl:apply-templates select="$projects/title"/>
>         </xsl:template>
>    
>     <xsl:template match="title">
>         <xsl:text>
>         </xsl:text>
>         <xsl:value-of select="."/>
>     </xsl:template>
> </xsl:transform>
> 
> The xml (sorry it's so long)
> 
> <staff staff_id="ybgiekxjb">
>     <project_staff_roles>
>         <project_staff_role project_id="5" staff_id="ybgiekxjb" 
> role_id="director">
>             <project project_id="5">
>                 <title>Separated Project</title>
>                 <acronym></acronym>
>                 <project_type> Project</project_type>
>                 <short_desc>This project is separated</short_desc>
>             </project>
>             <staff staff_id="ybgiekxjb">
>             </staff>
>             <project_role project_role_id="director">
>                 <title>Director</title>
>             </project_role>
>         </project_staff_role>
>         <project_staff_role project_id="5" staff_id="ybgiekxjb" 
> role_id="staff">
>             <project project_id="5">
>                 <title>Separated Project</title>
>                 <acronym></acronym>
>                 <project_type> Project</project_type>
>                 <short_desc>This project is separated</short_desc>
>             </project>
>             <project_role project_role_id="staff">
>                 <title>Staff</title>
>             </project_role>
>         </project_staff_role>
>         <project_staff_role project_id="12" staff_id="ybgiekxjb" 
> role_id="staff">
>             <project project_id="12">
>                 <title>Final Project Creation Test</title>
>                 <acronym>FPCT</acronym>
>                 <project_type> Project</project_type>
>                 <short_desc>The word project comes from the 
> Latin word projectum from the Latin verb
>                     proicere, "to throw something forwards" 
> which in turn comes from pro-, which
>                     denotes...</short_desc>
>             </project>
>             <project_role project_role_id="staff">
>                 <title>Staff</title>
>             </project_role>
>         </project_staff_role>
>         <project_staff_role project_id="14" staff_id="ybgiekxjb" 
> role_id="director">
>             <project project_id="14">
>                 <title>Another New Empty Project</title>
>                 <acronym></acronym>
>                 <project_type>Affiliated Center</project_type>
>                 <short_desc>Just the facts ma'am</short_desc>
>             </project>
>             <project_role project_role_id="director">
>                 <title>Director</title>
>             </project_role>
>         </project_staff_role>
>         <project_staff_role project_id="31" staff_id="ybgiekxjb" 
> role_id="staff">
>             <project project_id="31">
>                 <title>National Center on Educational Outcomes</title>
>                 <acronym>NCEO</acronym>
>                 <project_type>Affiliated Center</project_type>
>                 <short_desc>The Center provides national 
> leadership in the participation of
>                     students with disabilities in district, 
> state, and national assessments;
>                     standards-setting...</short_desc>
>             </project>
>             <project_role project_role_id="staff">
>                 <title>Staff</title>
>             </project_role>
>         </project_staff_role>
>         <project_staff_role project_id="37" staff_id="ybgiekxjb" 
> role_id="director">
>             <project project_id="37">
>                 <title>Making the Connection: Engaging and 
> Retaining Young Adults in
>                     Postsecondary Education</title>
>                 <acronym></acronym>
>                 <project_type> Project</project_type>
>                 <short_desc>develops a set of specific 
> intervention strategies that promote the
>                     retention of students ages 18-30 
> attending community colleges and at risk of
>                     leaving before...</short_desc>
>             </project>
>             <project_role project_role_id="director">
>                 <title>Director</title>
>             </project_role>
>         </project_staff_role>
>         <project_staff_role project_id="37" staff_id="ybgiekxjb" 
> role_id="reviewer">
>             <project project_id="37">
>                 <title>Making the Connection: Engaging and 
> Retaining Young Adults in
>                     Postsecondary Education</title>
>                 <acronym></acronym>
>                 <project_type> Project</project_type>
>                 <short_desc>develops a set of specific 
> intervention strategies that promote the
>                     retention of students ages 18-30 
> attending community colleges and at risk of
>                     leaving before...</short_desc>
>             </project>
>             <project_role project_role_id="reviewer">
>                 <title>Reviewer</title>
>             </project_role>
>         </project_staff_role>
>         <project_staff_role project_id="37" staff_id="ybgiekxjb" 
> role_id="staff">
>             <project project_id="37">
>                 <title>Making the Connection: Engaging and 
> Retaining Young Adults in
>                     Postsecondary Education</title>
>                 <acronym></acronym>
>                 <project_type> Project</project_type>
>                 <short_desc>develops a set of specific 
> intervention strategies that promote the
>                     retention of students ages 18-30 
> attending community colleges and at risk of
>                     leaving before...</short_desc>
>             </project>
>             <project_role project_role_id="staff">
>                 <title>Staff</title>
>             </project_role>
>         </project_staff_role>
>     </project_staff_roles>
> </staff>

Current Thread