Different output Saxon8B vs javax.xml.transform
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Thu Mar 22, 2007 5:15 pm
Different output Saxon8B vs javax.xml.transform
I am trying to debug an xsl doc using Oxegen. The calendar.xls creates a calendar and shows event descriptions on the day of the month that is relevant to the calendar.xml. I am confused now because I am getting different results from my program than from the debugger. When I run my program I see all events show up on the day of week that has any event. I beleive my xquery is wrong. When I run the xml/xsl through the debugger I do not see any events populate any day of the month. Any pointers woudl be appreciated.
calendar.xml
calendar.xsl
calendar.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<calendar-object>
<calendar-month-object>
<month-name>March</month-name>
<calendar-year>2007</calendar-year>
<month-number>2</month-number>
<month-days>31</month-days>
<start-day>5</start-day>
</calendar-month-object>
<calendar-event-object>
<start-date>3/20/2007</start-date>
<end-date>03/20/07</end-date>
<start-time>06:00:00 AM</start-time>
<end-time>08:30:00 AM</end-time>
<subject>Entrepreneurial training</subject>
<all-day-event>False</all-day-event>
<private>False</private>
</calendar-event-object>
<calendar-event-object>
<start-date>4/3/2007</start-date>
<end-date>04/03/07</end-date>
<start-time>06:00:00 AM</start-time>
<end-time>08:30:00 AM</end-time>
<subject>Entrepreneurial training.</subject>
<all-day-event>False</all-day-event>
<private>False</private>
</calendar-event-object>
<calendar-event-object>
<start-date>4/3/2007</start-date>
<end-date>04/03/07</end-date>
<start-time>06:00:00 AM</start-time>
<end-time>08:30:00 AM</end-time>
<subject>Food for thought</subject>
<all-day-event>False</all-day-event>
<private>False</private>
</calendar-event-object>
<calendar-event-object>
<start-date>4/24/2007</start-date>
<end-date>04/24/07</end-date>
<start-time>10:00:00 PM</start-time>
<end-time>11:00:00 PM</end-time>
<subject>Reading siminar</subject>
<all-day-event>False</all-day-event>
<private>False</private>
</calendar-event-object>
</calendar-object>
Code: Select all
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" encoding="UTF-8" />
<xsl:variable name="start"
select="/calendar-object/calendar-month-object/start-day" />
<xsl:variable name="count"
select="/calendar-object/calendar-month-object/month-days" />
<xsl:variable name="monthnumber"
select="/calendar-object/calendar-month-object/month-number" />
<xsl:variable name="year"
select="/calendar-object/calendar-month-object/calendar-year" />
<xsl:variable name="total" select="$start + $count - 1" />
<xsl:variable name="overflow" select="$total mod 7" />
<xsl:variable name="nelements">
<xsl:choose>
<xsl:when test="$overflow > 0">
<xsl:value-of select="$total + 7 - $overflow" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$total" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match="/">
<script>
function showSubject(msg){
document.getElementById('eventSubject').innerHTML=msg; }
function getCalendar(direction){
document.calendarForm.renderDate.value = "
<xsl:value-of select="$monthnumber" />
,
<xsl:value-of select="$year" />
," + direction; document.calendarForm.submit(); }
</script>
<form name="calendarForm" method="post" action="#">
<input type="hidden" name="renderDate" />
<center>
<table width="450">
<tr>
<td align="left">
<button onclick="getCalendar('-1')"
value="pre">
<<
</button>
</td>
<td align="center" width="100%">
<b style="font-size:16pt;">
<xsl:value-of
select="calendar-object/calendar-month-object/month-name" />
<xsl:text
disable-output-escaping="yes">
</xsl:text>
<xsl:value-of select="$year" />
</b>
</td>
<td align="right">
<button onclick="getCalendar('+1')">
>>
</button>
</td>
</tr>
</table>
</center>
</form>
<table style="table-layout:fixed;" border="1" bgcolor="yellow"
align="center" cellpadding="0" cellspacing="0" width="450"
height="350">
<tr bgcolor="white" style="font-size:10pt;">
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>
<xsl:call-template name="month" />
</table>
<br />
<br />
<center>
<div id="eventSubject" width="300" height="200"
style="align:justify;">
</div>
</center>
</xsl:template>
<!-- Called only once for root -->
<!-- Uses recursion with index + 7 for each week -->
<xsl:template name="month">
<xsl:param name="index" select="1" />
<xsl:if test="$index < $nelements">
<xsl:call-template name="week">
<xsl:with-param name="index" select="$index" />
</xsl:call-template>
<xsl:call-template name="month">
<xsl:with-param name="index" select="$index + 7" />
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Called repeatedly by month for each week -->
<xsl:template name="week">
<xsl:param name="index" select="1" />
<tr>
<xsl:call-template name="days">
<xsl:with-param name="index" select="$index" />
<xsl:with-param name="counter" select="$index + 6" />
</xsl:call-template>
</tr>
</xsl:template>
<!-- Called by week -->
<!-- Uses recursion with index + 1 for each day-of-week -->
<xsl:template name="days">
<xsl:param name="index" select="1" />
<xsl:param name="counter" select="1" />
<xsl:choose>
<xsl:when test="$index < $start">
<td>
<xsl:text disable-output-escaping="yes">
</xsl:text>
</td>
</xsl:when>
<xsl:when test="$index - $start + 1 > $count">
<td>
<xsl:text disable-output-escaping="yes">
</xsl:text>
</td>
</xsl:when>
<xsl:when test="$index > $start - 1">
<td align="left" valign="top">
<table width="100%" cellpadding="0"
cellspacing="0">
<tr>
<td align="left" valign="top"
style="font-size:8pt;">
<xsl:value-of
select="$index - $start + 1" />
</td>
<td>
<xsl:text
disable-output-escaping="yes">
</xsl:text>
</td>
</tr>
<xsl:for-each
select="/calendar-object/calendar-event-object">
<xsl:choose>
<xsl:when
test="/calendar-object/calendar-event-object/start-date=concat($monthnumber +1,'/',$index - $start + 1,'/',$year)">
<tr>
<td colspan="2"
onclick="showSubject(this.innerHTML)"
style="color:blue;cursor:hand;cursor:pointer;">
<b
style="font-size:10pt;">
<xsl:value-of
select="substring(subject,0,15)" />
...
</b>
</td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</table>
</td>
</xsl:when>
</xsl:choose>
<xsl:if test="$counter > $index">
<xsl:call-template name="days">
<xsl:with-param name="index" select="$index + 1" />
<xsl:with-param name="counter" select="$counter" />
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Different output Saxon8B vs javax.xml.transform
Post by sorin_ristache »
Hello,
Regards,
Sorin
What do you mean by your program? Did you try the transformation also in the Editor perspective of oXygen? I get the same HTML result file in the Editor perspective and in the XSLT Debugger perspective. If you do not get the expected output from the XSLT debugger then I think there is a problem in the logic implemented by your XSLT stylesheet. Can you post two smaller sample files and explain what output you expect?blaplante wrote:I am confused now because I am getting different results from my program than from the debugger. When I run my program I see all events show up on the day of week that has any event. I beleive my xquery is wrong. When I run the xml/xsl through the debugger I do not see any events populate any day of the month.
Regards,
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service