Project

Profile

Help

Bug #5449

closed

XSLT:garbage appended to output

Added by Arno Rosenboom about 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Low
Category:
PHP API
Start date:
2022-04-05
Due date:
% Done:

100%

Estimated time:
Found in version:
11.3
Fixed in version:
11.4
Platforms:

Description

hi! i'm using SaxonHE 11.3 (libsaxon-HEC-setup64-v11.3.zip) under Ubuntu 20.04.4 LTS and PHP 7.4.3 installation went smooth - no problems at all. but: when i do a relative simple transformation in php, there is some strange garbage appended to the html output. the $result variable contains the correct output string and some random characters in variable length changing on every transformation/call:

</html>7:36:01+0200
or
</html>�U
or
</html>esizeDuratio�

what can cause this behaviour? is there any common mistake i make? thanks in advance arni

these are the source files:

<?php
$xmlfile = "awxnotify.xml";
$xslfile = "awxnotify.xsl";
$saxon = new Saxon\SaxonProcessor();
$proc = $saxon->newXslt30Processor();
$exe = $proc->compileFromFile($xslfile);
$result = $exe->transformFileToString($xmlfile);
echo $result;
$exe->clearParameters();
$exe->clearProperties();
?>
<?xml version="1.0"?>
<events>
  <event>
    <id>{99996EEE-4E85-003F-B644-7E7D3757A91A}</id>
    <time>2022-04-03T00:24:12+0100</time>
    <subject>K&#xFC;chenfenster ge&#xF6;ffnet</subject>
    <src/>
    <desc/>
    <url>http://vm01.worxnet.localnet/cameras/kueche/030422-002411.jpg</url>
  </event>
  <event>
    <id>{EAF9112D-7E8B-909B-0579-E297C744490B}</id>
    <time>2022-04-03T00:27:25+0100</time>
    <subject>K&#xFC;chenfenster ge&#xF6;ffnet</subject>
    <src/>
    <desc/>
    <url>http://vm01.worxnet.localnet/cameras/kueche/030422-002724.jpg</url>
  </event>
  <event>
    <id>{49C54A20-50B3-C5F0-206E-3C96150132C8}</id>
    <time>2022-04-03T00:29:33+0100</time>
    <subject>Briefkasten ge&#xF6;ffnet</subject>
    <src/>
    <desc/>
    <url>http://vm01.worxnet.localnet/cameras/haustuer/030422-002932.jpg</url>
  </event>
</events>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xhtml" encoding="utf-8" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" indent="yes" />
<xsl:template match="/">
<html>
<head>
<title>awxNotify</title>
</head>
<body>

<table id="main">
<thead>
	<tr class="head">
		<th>Time</th>
		<th>Image</th>
		<th>Subject</th>
		<th>Description</th>
	</tr>
</thead>
<xsl:element name="tbody">
	<xsl:for-each select="events/event">
		<xsl:sort select="time" order="descending" />
		<xsl:element name="tr">
			<xsl:attribute name="class">
				<xsl:text>entry</xsl:text>
			</xsl:attribute>
			<xsl:apply-templates select="time" />
			<xsl:apply-templates select="url" />
			<xsl:apply-templates select="subject" />
			<xsl:apply-templates select="desc" />
		</xsl:element>
	</xsl:for-each>
</xsl:element>
</table>

</body>
</html>
</xsl:template>

<xsl:template match="time">
	<xsl:element name="td">
		<xsl:attribute name="class">
			<xsl:text>time</xsl:text>
		</xsl:attribute>
		<xsl:value-of select="." />
	</xsl:element>
</xsl:template>

<xsl:template match="subject">
	<xsl:element name="td">
		<xsl:attribute name="class">
			<xsl:text>subject</xsl:text>
		</xsl:attribute>
		<xsl:value-of select="." />
	</xsl:element>
</xsl:template>

<xsl:template match="desc">
	<xsl:element name="td">
		<xsl:attribute name="class">
			<xsl:text>desc</xsl:text>
		</xsl:attribute>
		<xsl:value-of select="." />
	</xsl:element>
</xsl:template>	

<xsl:template match="url">
	<xsl:element name="td">
		<xsl:attribute name="class">
			<xsl:text>url</xsl:text>
		</xsl:attribute>
		<xsl:if test=". != ''">
			<xsl:element name="a">
				<xsl:attribute name="href">
					<xsl:value-of select="." />
				</xsl:attribute>
				<xsl:text>Image</xsl:text>
			</xsl:element>
		</xsl:if>
	</xsl:element>
</xsl:template>	
</xsl:stylesheet>

Please register to edit this issue

Also available in: Atom PDF