Sorry to disturb you, but I need you help, I've passed 4 hours on this problem, no way !
Here is the code xslt : <xsl:variable name="anneedebut4" select="document('personal.xml')//From/Year"/> <xsl:variable name="anneefin4" select="document('personal.xml')//To/Year"/> <xsl:variable name="moisdebut4" select="document('personal.xml')//From/Month"/> <xsl:variable name="moisfin4" select="document('personal.xml')//To/Month"/> <xsl:call-template name="personnel"> <xsl:with-param name="total_FY" select="$anneedebut4"/> <xsl:with-param name="total_TY" select="$anneefin4"/> <xsl:with-param name="total_FM" select="$moisdebut 4"/> <xsl:with-param name="total_TM" select="$moisfin4"/> </xsl:call-template> <xsl:template name="personnel"> <xsl:param name="total_FY"/> <xsl:param name="total_TY"/> <xsl:param name="total_FM"/> <xsl:param name="total_TM"/> <xsl:choose> <xsl:when test="$total_FY=number$total_TY and $total_FM=$total_TM"> <xhtml:tr height="18" style="height:13.5pt"> &nb sp; <xhtml:td height="18" style="padding-left:1em;text-align:center;padding-right:1em;height:13.5pt"> <xsl:text>---------</xsl:text> </xhtml:td> <xhtml:td class="mois" style="font-weight:400;font-style:normal;text-align:center;padding-left:1em;padding-right:1em;"> <xsl:text>---------</xsl:text>   ;</xhtml:td> <xhtml:td style="padding-left:1em;text-align:center;padding-right:1em;"> <xsl:text>------------------------------</xsl:text> </xhtml:td> <xhtml:td style="text-align:center;padding-left:1em;padding-right:1em;"> <xsl:text>---------</xsl:text> </xhtml:td> <xhtml:td style="text-align:center;" align="right"> <xsl:text>---------</xsl:text> </xhtml:td> <xsl:variable name="total_of_month_CHF"> <xsl:value-of select="sum(document('personal.xml')/LabExpenses/YearlyExpenses[Year=$totalFY]/Personnel/StaffMember/Expenses/Expense[Month=$total_FM]/Amount)"/> &nb sp; </xsl:variable> <xhtml:td style="text-align:center;" align="right"> <xsl:value-of select="format-number($total_of_month_CHF, '#.00')"/> </xhtml:td> <xhtml:td style="text-align:center;" align="right"> <xsl:value-of select="format-number($total_of_month_CHF div 1.5, '#.00')"/> &n bsp; </xhtml:td> <xhtml:td style="text-align:center;" align="right"> <xsl:value-of select="$total_FM"/> <xsl:text>.</xsl:text> <xsl:value-of select="$total_FY"/> </xhtml:td> <xht ml:td colspan="3"/> </xhtml:tr> </xsl:when> <xsl:otherwise> <xsl:if test="$total_FM = 12"> <xsl:call-template name="Calcul_Total_Personnel"> <xsl:with-param name="total_FY" select="$total_FY + 1"/> <xsl:with-param name="total_TY" select="$total_TY&quo t;/> <xsl:with-param name="total_FM" select="number('1')"/> <xsl:with-param name="total_TM" select="$total_TM"/> </xsl:call-template> </xsl:if> <xsl:if test="not($total_FM=12)"> <xsl:call-template name="Calcul_Total_Personnel"> <xsl:with-param name="total_FY" select="$total_FY"/> <xsl:with-param name="total_TY" select="$total_TY"/> <xsl:with-param name="total_FM" select="$total_FM + 1"/> <xsl:with-param name="total_TM" select="$total_TM"/> </xsl:call-template> </xsl:if> <xhtml:tr height="18" style="height:13.5pt"> <xhtml:td height="18" style="padding-left:1em;text-align:center;padding-right:1em;height:13.5pt"> </xhtml:td> <xhtml:td class="mois" style="font-weight:400;font-style:normal;text-align:center;padding-left:1em;padding-right:1em;"> &nb sp; </xhtml:td> <xhtml:td style="padding-left:1em;text-align:center;padding-right:1em;"> </xhtml:td> <xhtml:td style="text-align:center;padding-left:1em;padding-right:1em;"> </xhtml:td> & nbsp; <xhtml:td style="text-align:center;" align="right"> </xhtml:td> <xsl:variable name="total_of_month_CHF2"> <xsl:value-of select="sum(document('personal.xml')//YearlyExpenses[Year=$totalFY]/Personnel/StaffMember/Expenses/Expense[Month=$total_FM])/Amount"/> </xsl:variable> &nbs p; <xhtml:td style="text-align:center;" align="right"> <xsl:value-of select="$total_of_month_CHF2"/> </xhtml:td> <xhtml:td style="text-align:center;" align="right"> <xsl:value-of select="$total_of_month_CHF2 div 1.5"/> </xhtml:td> <xhtml:td style="text-align:center;" align="right"> <xsl:value-of select="$total_FM"/> <xsl:text>.</xsl:text> <xsl:value-of select="$total_FY"/> </xhtml:td> <xhtml:td colspan="3"/> </xhtml:tr> &nb sp; </xsl:otherwise> </xsl:choose> </xsl:template> And here is the data : personal.xml : <result> <SheetPersonal> <From> <Month>12</Month> <Year>2006</Year> </From> <To> <Month>12</Month> <Year>2006</Year> </To> <Expenses> <YearlyExpenses> <Year>2006</Year& gt; <Personnel> <StaffMember> <PersonId>El Helou Sandy</PersonId> <Expenses> &nbs p; <Expense> <Month>8</Month> <OccupationRate>75</OccupationRate> <Amount Currency="CHF">3541.75</Amount> &nb sp; </Expense> <Expense> <Month>9</Month> <OccupationRate>75</OccupationRate> &nb sp; <Amount Currency="CHF">4347.6</Amount> </Expense> <Expense> <Month>10</Month> &n bsp; <OccupationRate>75</OccupationRate> <Amount Currency="CHF">4347.6</Amount> </Expense> < /Expenses> </StaffMember> </Personnel> </YearlyExpenses> </Expenses> <Expenses> <YearlyExpenses> & nbsp; <Year>2006</Year> <Personnel> <StaffMember> <PersonId>Eckard Emmanuel</PersonId> <Expenses> &n bsp; <Expense> <Month>3</Month> <OccupationRate>50</OccupationRate> <Amount Currency="CHF">3851.5</Amount> </Expense> </Expenses> </StaffMember> <StaffMember>   ; <PersonId>Ailomaa Marita</PersonId> <Expenses> <Expense> <Month>3</Month>   ; <OccupationRate>25</OccupationRate> <Amount Currency="CHF">1449.05</Amount> </Expense> <Expense> &nbs p; <Month>4</Month> <OccupationRate>25</OccupationRate> <Amount Currency="CHF">1449.05</Amount> </Expense> &n bsp; <Expense> <Month>5</Month> <OccupationRate>25</OccupationRate> <Amount Currency="CHF&q uot;>1449.05</Amount> </Expense> <Expense> <Month>6</Month>   ; <OccupationRate>25</OccupationRate> <Amount Currency="CHF">1449.05</Amount> </Expense> <Expense> &nb sp; <Month>7</Month> <OccupationRate>25</OccupationRate> <Amount Currency="CHF">1449.05</Amount> </Expense> &n bsp; <Expense> <Month>8</Month> <OccupationRate>25</OccupationRate> <Amount Currency="CHF">1449.05</Amount> & nbsp; </Expense> <Expense> <Month>9</Month> <OccupationRate>25</OccupationRat e> <Amount Currency="CHF">1449.05</Amount> </Expense> <Expense> &nb sp; <Month>10</Month> <OccupationRate>25</OccupationRate> <Amount Currency="CHF">1449.05</Amount> </Expense> </Expenses> </StaffMember> </Personnel> </YearlyExpenses> </Expenses> </SheetPersonal> </result> ----------------------------------------------------------------------------------------------------------- So, I've got some compilations errors in xslt file. The prob lem probably comes from the incompatibility between the comparaison into number and String. I'm trying to explain as clearer as possible, I hope you understand ! Thank you ! ----------------------------------------------------- -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Can you point to the line of error, or is it -1 ?
Sorry, I can't understand what the problem is, but you
can convert with string() or number() to insure your
comparison is with like types.
--Hank
-- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by Wang Yan
Yan,
Your XSLT file appears garbled. Can you please attach files rather than just paste them in the body of the email? Also, please make sure you include a complete XSLT file. But note that if it's strictly an XSLT issue, I recommend posting the question to saxon-help. -Erik Wang Yan wrote: > Sorry to disturb you, but I need you help, I've passed 4 hours on this > problem, no way ! > > Here is the code xslt : > <xsl:variable name="anneedebut4" > select="document('personal.xml')//From/Year"/> > <xsl:variable name="anneefin4" select="document('personal.xml')//To/Year"/> > <xsl:variable name="moisdebut4" > select="document('personal.xml')//From/Month"/> > <xsl:variable name="moisfin4" select="document('personal.xml')//To/Month"/> > > <xsl:call-template name="personnel"> > <xsl:with-param name="total_FY" select="$anneedebut4"/> > <xsl:with-param name="total_TY" select="$anneefin4"/> > <xsl:with-param name="total_FM" select="$moisdebut 4"/> > <xsl:with-param name="total_TM" select="$moisfin4"/> > </xsl:call-template> > > > <xsl:template name="personnel"> > <xsl:param name="total_FY"/> > <xsl:param name="total_TY"/> > <xsl:param name="total_FM"/> > <xsl:param name="total_TM"/> > <xsl:choose> > <xsl:when test="$total_FY=number$total_TY and > $total_FM=$total_TM"> > <xhtml:tr height="18" style="height:13.5pt"> > &nb sp; <xhtml:td height="18" > style="padding-left:1em;text-align:center;padding-right:1em;height:13.5pt"> > <xsl:text>---------</xsl:text> > </xhtml:td> > <xhtml:td class="mois" > style="font-weight:400;font-style:normal;text-align:center;padding-left:1em;padding-right:1em;"> > <xsl:text>---------</xsl:text> > ;</xhtml:td> > <xhtml:td > style="padding-left:1em;text-align:center;padding-right:1em;"> > <xsl:text>------------------------------</xsl:text> > </xhtml:td> > <xhtml:td > style="text-align:center;padding-left:1em;padding-right:1em;"> > <xsl:text>---------</xsl:text> > </xhtml:td> > <xhtml:td style="text-align:center;" align="right"> > <xsl:text>---------</xsl:text> > </xhtml:td> > <xsl:variable name="total_of_month_CHF"> > <xsl:value-of > select="sum(document('personal.xml')/LabExpenses/YearlyExpenses[Year=$totalFY]/Personnel/StaffMember/Expenses/Expense[Month=$total_FM]/Amount)"/> > &nb sp; </xsl:variable> > <xhtml:td style="text-align:center;" align="right"> > <xsl:value-of > select="format-number($total_of_month_CHF, '#.00')"/> > </xhtml:td> > <xhtml:td style="text-align:center;" align="right"> > <xsl:value-of > select="format-number($total_of_month_CHF div 1.5, '#.00')"/> > &n bsp; </xhtml:td> > <xhtml:td style="text-align:center;" align="right"> > <xsl:value-of select="$total_FM"/> > <xsl:text>.</xsl:text> > <xsl:value-of select="$total_FY"/> > </xhtml:td> > <xht ml:td colspan="3"/> > </xhtml:tr> > </xsl:when> > <xsl:otherwise> > <xsl:if test="$total_FM = 12"> > <xsl:call-template name="Calcul_Total_Personnel"> > <xsl:with-param name="total_FY" > select="$total_FY + 1"/> > <xsl:with-param name="total_TY" > select="$total_TY&quo t;/> > <xsl:with-param name="total_FM" > select="number('1')"/> > <xsl:with-param name="total_TM" select="$total_TM"/> > </xsl:call-template> > </xsl:if> > <xsl:if test="not($total_FM=12)"> > <xsl:call-template name="Calcul_Total_Personnel"> > <xsl:with-param name="total_FY" select="$total_FY"/> > <xsl:with-param name="total_TY" select="$total_TY"/> > <xsl:with-param name="total_FM" > select="$total_FM + 1"/> > <xsl:with-param name="total_TM" select="$total_TM"/> > </xsl:call-template> > </xsl:if> > <xhtml:tr height="18" style="height:13.5pt"> > <xhtml:td height="18" > style="padding-left:1em;text-align:center;padding-right:1em;height:13.5pt"> > > </xhtml:td> > <xhtml:td class="mois" > style="font-weight:400;font-style:normal;text-align:center;padding-left:1em;padding-right:1em;"> > > &nb sp; </xhtml:td> > <xhtml:td > style="padding-left:1em;text-align:center;padding-right:1em;"> > > </xhtml:td> > <xhtml:td > style="text-align:center;padding-left:1em;padding-right:1em;"> > > </xhtml:td> > & nbsp; <xhtml:td style="text-align:center;" > align="right"> > > </xhtml:td> > <xsl:variable name="total_of_month_CHF2"> > <xsl:value-of > select="sum(document('personal.xml')//YearlyExpenses[Year=$totalFY]/Personnel/StaffMember/Expenses/Expense[Month=$total_FM])/Amount"/> > </xsl:variable> > &nbs p; <xhtml:td style="text-align:center;" > align="right"> > <xsl:value-of select="$total_of_month_CHF2"/> > </xhtml:td> > <xhtml:td style="text-align:center;" align="right"> > <xsl:value-of select="$total_of_month_CHF2 div > 1.5"/> > </xhtml:td> > <xhtml:td style="text-align:center;" align="right"> > <xsl:value-of select="$total_FM"/> > <xsl:text>.</xsl:text> > <xsl:value-of select="$total_FY"/> > </xhtml:td> > <xhtml:td colspan="3"/> > </xhtml:tr> > &nb sp; </xsl:otherwise> > </xsl:choose> > </xsl:template> > > > And here is the data : personal.xml : > > <result> > <SheetPersonal> > <From> > <Month>12</Month> > <Year>2006</Year> > </From> > <To> > <Month>12</Month> > <Year>2006</Year> > </To> > > > <Expenses> > <YearlyExpenses> > <Year>2006</Year& gt; > <Personnel> > <StaffMember> > <PersonId>El Helou Sandy</PersonId> > <Expenses> > &nbs p; <Expense> > <Month>8</Month> > > <OccupationRate>75</OccupationRate> > <Amount > Currency="CHF">3541.75</Amount> > &nb sp; </Expense> > <Expense> > <Month>9</Month> > > <OccupationRate>75</OccupationRate> > &nb sp; <Amount > Currency="CHF">4347.6</Amount> > </Expense> > <Expense> > <Month>10</Month> > &n bsp; > <OccupationRate>75</OccupationRate> > <Amount > Currency="CHF">4347.6</Amount> > </Expense> > < /Expenses> > </StaffMember> > </Personnel> > </YearlyExpenses> > </Expenses> > <Expenses> > <YearlyExpenses> > & nbsp; <Year>2006</Year> > <Personnel> > <StaffMember> > <PersonId>Eckard Emmanuel</PersonId> > <Expenses> > &n bsp; <Expense> > <Month>3</Month> > > <OccupationRate>50</OccupationRate> > <Amount > Currency="CHF">3851.5</Amount> > </Expense> > </Expenses> > </StaffMember> > <StaffMember> > ; <PersonId>Ailomaa > Marita</PersonId> > <Expenses> > <Expense> > <Month>3</Month> > ; > <OccupationRate>25</OccupationRate> > <Amount > Currency="CHF">1449.05</Amount> > </Expense> > <Expense> > &nbs p; <Month>4</Month> > > <OccupationRate>25</OccupationRate> > <Amount > Currency="CHF">1449.05</Amount> > </Expense> > &n bsp; <Expense> > <Month>5</Month> > > <OccupationRate>25</OccupationRate> > <Amount Currency="CHF&q > uot;>1449.05</Amount> > </Expense> > <Expense> > <Month>6</Month> > ; > <OccupationRate>25</OccupationRate> > <Amount > Currency="CHF">1449.05</Amount> > </Expense> > <Expense> > &nb sp; <Month>7</Month> > > <OccupationRate>25</OccupationRate> > <Amount > Currency="CHF">1449.05</Amount> > </Expense> > &n bsp; <Expense> > <Month>8</Month> > > <OccupationRate>25</OccupationRate> > <Amount > Currency="CHF">1449.05</Amount> > & nbsp; </Expense> > <Expense> > <Month>9</Month> > > <OccupationRate>25</OccupationRat e> > <Amount > Currency="CHF">1449.05</Amount> > </Expense> > <Expense> > &nb sp; <Month>10</Month> > > <OccupationRate>25</OccupationRate> > <Amount > Currency="CHF">1449.05</Amount> > </Expense> > </Expenses> > </StaffMember> > </Personnel> > </YearlyExpenses> > </Expenses> > </SheetPersonal> > </result> > ----------------------------------------------------------------------------------------------------------- > > So, I've got some compilations errors in xslt file. The prob lem > probably comes from the incompatibility between the comparaison > into number and String. > > I'm trying to explain as clearer as possible, I hope you understand ! > > Thank you ! Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |