ho scritto un foglio di stile XSL che prende i dati da due diversi file XML e li scrive in una pagina HTML.
Il problema sta nel fatto che al momento della trasformazione ho il seguente errore
Errore interpretazione XML: contenuto illegale dopo l'elemento Indirizzo: file:///C:/Users/Arc%C3%A0/workspace/xmlparsing/bin/md_testa_cm.xml Linea numero 4, colonna 1:<Instance>testa_cm</Instance> ^
Ho capito che il problema sorge da uno solo dei due file, ma nn capisco il perche, spero che qualcuno possa aiutarmi.
Questi sono i file
primo xml, ovvero quello che non da' errore
codice:
<?xml version='1.0' encoding='ISO-8859-1' ?>
<?xml-stylesheet type="text/xsl" href="tabella.xsl"?>
<Mpeg7><DescriptionUnit><Descriptor><Region><RegionNumber>255</RegionNumber>
<GlobalCurvature>2 1 </GlobalCurvature>
<PrototypeCurvature>1 1 </PrototypeCurvature>
<HighestPeakY>8</HighestPeakY>
</Region>
</Descriptor>
</DescriptionUnit>
</Mpeg7>
secondo xml, quello a cui l'errore si riferisce
codice:
<?xml version='1.0' encoding='ISO-8859-1' ?>
<?xml-stylesheet type="text/xsl" href="tabella.xsl"?>
<Concept>Contour Shape</Concept>
<Instance>testa_cm</Instance>
<Descriptor>cavallo</Descriptor>
foglio di stile xsl
codice:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><xsl:value-of select="Instance"/></title>
<style type="text/css">
<xsl:comment>
</xsl:comment>
</style>
</head>
<body>
<h1 align="center"><u>Nome Istanza: <xsl:value-of select="Instance"/></u></h1>
<h3 align="center"><u>Descrittore Istanza: <xsl:value-of select="Descriptor"/></u></h3>
<td width="150" align="center">
<img align="right">
<xsl:attribute name="src">
<xsl:value-of select="Mpeg7/DescriptionUnit/Descriptor/Region/img"/>
</xsl:attribute>
</img>
</td>
<table width="419" height="180" border="3" align="center" bordercolor="#FF0000" bgcolor="#FFFFFF">
<caption>
Tipo di descrittore: <xsl:value-of select="Concept"/>
</caption>
<tr>
<th width="259" scope="row">Region Number</th>
<td width="144">
<div align="center">
<xsl:value-of select="Mpeg7/DescriptionUnit/Descriptor/Region/RegionNumber"/>
</div>
</td>
</tr>
<tr>
<th scope="row">Global Curvature Circularity/Global Curvature Eccentricity</th>
<td>
<div align="center">
<xsl:value-of select="Mpeg7/DescriptionUnit/Descriptor/Region/GlobalCurvature"/>
</div>
</td>
</tr>
<tr>
<th scope="row">Prototype Curvature Circularity/Global Curvature Eccentricity</th>
<td>
<div align="center">
<xsl:value-of select="Mpeg7/DescriptionUnit/Descriptor/Region/PrototypeCurvature"/>
</div>
</td>
</tr>
<tr>
<th scope="row">Highest Peak Y</th>
<td>
<div align="center">
<xsl:value-of select="Mpeg7/DescriptionUnit/Descriptor/Region/HighestPeakY"/>
</div>
</td>
</tr>
</table>
<table width="200" height="166" border="3" align="center" bordercolor="#FF0000">
<tr>
<th height="31" scope="col">Peak X</th>
<th scope="col">Peak Y</th>
</tr>
<xsl:for-each select="Mpeg7/DescriptionUnit/Descriptor/Region/Peak">
<tr>
<td>
<div align="center">
<xsl:value-of select="@peakX"/>
</div>
</td>
<td>
<div align="center">
<xsl:value-of select="@peakY"/>
</div>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>