XSLT problemer i browser. Skyldes det ikke escapede characters?
Hejsajeg har fået til overgave at præsentere nogle fakturaer der leveres som xml til xhtml vha. af et xslt.
xslt'en er blevet leveret til mig, men jeg har nogle problemer med at få xml vist i en browser. Det virker fint i en editor som Word eller anden tyk editor. Jeg har mistanke om at det skyldes at den indlejrede html ikke escapes.
Før jeg sætter mig til at gøre det manuelt kan en så bekræfte at det er der problemer findes.
Hvis jeg bare vælger at åbne xslt'en eller xml direkte i en browser får jeg ingen fejl.
Hvis jeg indsætter et link til XSLT direkte i header på XML'en fx:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="xml2xhtml.xsl"?>
Får jeg følgende fejl i browseren når xml åbnes:
An invalid character was found in text content. Error processing resource 'file:///C:/TEMP/Test/1.xsl'. Line 70, Position ...
<!-- inds
På forhånd tak
Rasmus
XSLT
***************************************
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl= "http://www.w3.org/1999/XSL/Transform"
xmlns:udk= "http://rep.oio.dk/ubl/xml/schemas/0p71/maindoc/"
xmlns:com= "http://rep.oio.dk/ubl/xml/schemas/0p71/common/"
xmlns:pie= "http://rep.oio.dk/ubl/xml/schemas/0p71/pie/"
xmlns:tpcm="http://rep.oio.dk/ubl/xml/schemas/0p71/testpcm/"
xmlns:tpcp="http://rep.oio.dk/ubl/xml/schemas/0p71/testpcp/"
xmlns:tpie="http://rep.oio.dk/ubl/xml/schemas/0p71/testpie/"
xmlns:tpip="http://rep.oio.dk/ubl/xml/schemas/0p71/testpip/"
xmlns:pip= "http://rep.oio.dk/ubl/xml/schemas/0p71/pip/"
xmlns:pcm= "http://rep.oio.dk/ubl/xml/schemas/0p71/pcm/"
xmlns:pcp= "http://rep.oio.dk/ubl/xml/schemas/0p71/pcp/">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="/*[local-name()='Invoice']"/>
</xsl:template>
<xsl:template match="udk:Invoice| pip:Invoice | pie:Invoice | pcm:Invoice |tpcm:Invoice |tpcp:Invoice|tpie:Invoice|tpip:Invoice | pcp:Invoice ">
<xsl:variable name="fakturatype">
<xsl:choose>
<xsl:when test="contains(com:TypeCode, 'PIE')">FAKTURA</xsl:when>
<xsl:when test="contains(com:TypeCode, 'PIP')">FAKTURA</xsl:when>
<xsl:when test="contains(com:TypeCode, 'PCM')">KREDITNOTA</xsl:when>
<xsl:when test="contains(com:TypeCode, 'PCP')">KREDITNOTA</xsl:when>
<xsl:otherwise>Ukendt dokumenttype</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<html>
<head>
<title>OIOXML faktura (<xsl:value-of select="com:TypeCode"/>)</title>
</head>
<body>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td valign="top"><font face="Arial"><xsl:value-of select="$fakturatype"/></font></td>
<td valign="top"></td>
<td valign="top"></td>
<td valign="top"></td>
</tr>
<tr>
<td width="100%" valign="top" colspan="4" bgcolor="#FFFFFF" height="2"><hr color="#A1B4C4" size="5" NOSHADE="true"/></td>
</tr>
<tr>
<td valign="top" colspan="2" bgcolor="#FFFFFF"><font face="Arial" size="2">
<b>Kober</b><br/>
EAN: <xsl:value-of select="com:BuyersReferenceID"/><br/>
Ordrekontakt.: <xsl:value-of select="com:BuyerParty/com:BuyerContact/com:Name"/><br/>
DimensionsKonto: <xsl:value-of select="com:BuyerParty/com:AccountCode"/><br/></font>
</td>
<td valign="top" bgcolor="#FFFFFF"><font face="Arial" size="2">
<b>Juridisk</b><br/>
<xsl:for-each select="com:BuyerParty">
<xsl:if test = "com:Address/com:ID = 'Juridisk'">
<xsl:value-of select="com:PartyName"/><br/>
<xsl:value-of select="com:Address/com:Street"/>
<xsl:text> </xsl:text>
<xsl:value-of select="com:Address/com:HouseNumber"/><br/>
<xsl:value-of select="com:Address/com:PostalZone"/>
<xsl:text> </xsl:text>
<xsl:value-of select="com:Address/com:CityName"/><br/>
</xsl:if>
</xsl:for-each>
</font>
</td>
<td valign="top" bgcolor="#FFFFFF"><font face="Arial" size="2">
<!-- indsætter Faktureringsadressen -->
<b>Faktureringsadresse</b><br/>
<xsl:for-each select="com:BuyerParty">
<xsl:if test = "com:Address/com:ID = 'Fakturering'">
<xsl:value-of select="com:PartyName"/><br/>
<xsl:value-of select="com:Address/com:Street"/>
<xsl:text> </xsl:text>
<xsl:value-of select="com:Address/com:HouseNumber"/><br/>
<xsl:value-of select="com:Address/com:PostalZone"/>
<xsl:text> </xsl:text>
<xsl:value-of select="com:Address/com:CityName"/><br/>
</xsl:if>
</xsl:for-each>
</font>
</td>
</tr>
<tr>
<td width="100%" valign="top" colspan="4" bgcolor="#FFFFFF" height="1"><hr color="#A1B4C4" size="2" NOSHADE="true"/></td>
</tr>
<tr>
<td valign="top" colspan="2" bgcolor="#FFFFFF"><font face="Arial" size="2">
<!-- indsætter leverandøradressen -->
<b>Leverandør</b><br/>
<xsl:value-of select="com:SellerParty/com:PartyName"/><br/>
<xsl:value-of select="com:SellerParty/com:Address/com:Street"/>
<xsl:text> </xsl:text>
<xsl:value-of select="com:SellerParty/com:Address/com:HouseNumber"/><br/>
<xsl:value-of select="com:SellerParty/com:Address/com:PostalZone"/>
<xsl:text> </xsl:text>
<xsl:value-of select="com:SellerParty/com:Address/com:CityName"/><br/>
CVR.: <xsl:value-of select="com:SellerParty/com:PartyTaxScheme/com:CompanyTaxID"/><br/></font>
</td>
<td valign="top" colspan="2" bgcolor="#FFFFFF"><font face="Arial" size="2">
<b>Kontaktoplysninger</b><br/>
<xsl:value-of select="com:SellerParty/com:OrderContact/com:Name"/><br/>
Tlf.: <xsl:value-of select="com:SellerParty/com:OrderContact/com:Phone"/><br/>
Email.: <xsl:value-of select="com:SellerParty/com:OrderContact/com:E-Mail"/><br/></font>
</td>
</tr>
<tr>
<td width="100%" valign="top" colspan="4" bgcolor="#FFFFFF" height="1"><hr color="#A1B4C4" size="2" NOSHADE="true"/></td>
</tr>
<tr>
<td width="26%" valign="top" bgcolor="#FFFFFF">
<font face="Arial" size="2"><b>Fakturanr: </b>
<xsl:value-of select="com:ID"/></font>
</td>
<td width="26%" valign="top" bgcolor="#FFFFFF">
<font face="Arial" size="2"><b>Købers ordrenr: </b>
<xsl:value-of select="com:ReferencedOrder/com:BuyersOrderID"/></font>
</td>
<td width="23%" valign="top" bgcolor="#FFFFFF">
<font face="Arial" size="2"><b>Sælgers ordrenr: </b>
<xsl:value-of select="com:ReferencedOrder/com:SellersOrderID"/></font>
</td>
<td width="27%" valign="top" bgcolor="#FFFFFF">
<font face="Arial" size="2"><b>Dato: </b>
<xsl:value-of select="com:IssueDate"/></font>
</td>
</tr>
<tr>
<td width="100%" valign="top" colspan="4" bgcolor="#FFFFFF" height="1"><hr color="#A1B4C4" size="2" NOSHADE="true"/></td>
</tr>
</table>
<br/>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td valign="top"><font face="Arial" size="2"><b>Varenr</b></font></td>
<td valign="top"><font face="Arial" size="2"><b>Beskrivelse</b></font></td>
<td valign="top"><font face="Arial" size="2"><b>Antal</b></font></td>
<td valign="top"><font face="Arial" size="2"><b>Enhed</b></font></td>
<td valign="top"><font face="Arial" size="2"><b>Enhedspris</b></font></td>
<td valign="top"><font face="Arial" size="2"><b></b></font></td>
<td valign="top" align="right"><font face="Arial" size="2">
<b>Pris</b></font><br/>
</td>
</tr>
<xsl:apply-templates select="com:InvoiceLine"/>
<tr>
<td colspan="7" valign="top" height="10"><font face="Arial" size="1"></font>
</td>
</tr>
<tr>
<td width="100%" valign="top" colspan="7" bgcolor="#FFFFFF" height="1"><hr color="#A1B4C4" size="2" NOSHADE="true"/></td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" colspan="6"><font face="Arial" size="2"><b>Pris i alt excl moms</b></font></td>
<td valign="top" bgcolor="#FFFFFF" align="right">
<font face="Arial" size="2">
<xsl:variable name="tot1" select="com:LegalTotals/com:LineExtensionTotalAmount"/>
<xsl:value-of select="format-number($tot1, '##0.00')"/>
</font>
</td>
</tr>
<xsl:for-each select="com:AllowanceCharge">
<tr>
<td valign="top" bgcolor="#FFFFFF" colspan="6"><font face="Arial" size="2"><b><xsl:value-of select="com:ID"/></b></font></td>
<td valign="top" bgcolor="#FFFFFF" align="right">
<font face="Arial" size="2">
<xsl:variable name="tot2" select="com:AllowanceChargeAmount"/>
<xsl:value-of select="format-number($tot2, '##0.00')"/>
</font>
</td>
</tr>
</xsl:for-each>
<tr>
<xsl:variable name="momspct" select="com:TaxTotal/com:CategoryTotal/com:RatePercentNumeric"/>
<td valign="top" bgcolor="#FFFFFF" colspan="6"><font face="Arial" size="2"><b>Total momsbeløb (<xsl:value-of select="format-number($momspct, '##0.00')"/>%)</b></font></td>
<td valign="top" bgcolor="#FFFFFF" align="right">
<font face="Arial" size="2">
<xsl:variable name="tot4" select="com:TaxTotal/com:TaxAmounts/com:TaxAmount"/>
<xsl:value-of select="format-number($tot4, '##0.00')"/>
</font>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF" colspan="6"><font face="Arial" size="2"><b>Total incl moms</b></font></td>
<td valign="top" bgcolor="#FFFFFF" align="right">
<font face="Arial" size="2">
<xsl:variable name="tot5" select="com:LegalTotals/com:ToBePaidTotalAmount"/>
<xsl:value-of select="format-number($tot5, '##0.00')"/>
</font>
</td>
</tr>
<tr>
<td width="100%" valign="top" colspan="7" bgcolor="#FFFFFF" height="2"><hr color="#A1B4C4" size="5" NOSHADE="true"/></td>
</tr>
</table>
<br/>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td valign="top"></td>
<td valign="top"></td>
<td valign="top"></td>
<td valign="top"></td>
</tr>
<tr>
<td valign="top" colspan="4" bgcolor="#FFFFFF"><font face="Arial" size="2">
<b>Betalingsoplysninger</b><br/>
<xsl:choose>
<xsl:when test = "com:PaymentMeans/com:PaymentChannelCode = 'KONTOOVERFØRSEL'">
Forfaldsdato: <xsl:value-of select="com:PaymentMeans/com:PaymentDueDate"/><br/>
Valutakode: <xsl:value-of select="udk:InvoiceCurrencyCode"/><br/>
Betalingstype: <xsl:value-of select="com:PaymentMeans/com:PaymentChannelCode"/><br/>
Kontotype.: <xsl:value-of select="com:PaymentMeans/com:PayeeFinancialAccount/com:TypeCode"/><br/>
Regnr: <xsl:value-of select="com:PaymentMeans/com:PayeeFinancialAccount/com:FiBranch/com:ID"/><br/>
Kontonr.: <xsl:value-of select="com:PaymentMeans/com:PayeeFinancialAccount/com:ID"/><br/>
Pengeinstitut: <xsl:value-of select="com:PaymentMeans/com:PayeeFinancialAccount/com:FiBranch/com:FinancialInstitution/com:Name"/><br/>
</xsl:when>
<xsl:when test = "com:PaymentMeans/com:PaymentChannelCode = 'INDBETALINGSKORT'">
Forfaldsdato: <xsl:value-of select="com:PaymentMeans/com:PaymentDueDate"/><br/>
Valutakode: <xsl:value-of select="udk:InvoiceCurrencyCode"/><br/>
Betalingstype: <xsl:value-of select="com:PaymentMeans/com:PaymentChannelCode"/><br/>
Kortart: <xsl:value-of select="com:PaymentMeans/com:TypeCodeID"/><br/>
Betalingsid: <xsl:value-of select="com:PaymentMeans/com:PaymentID"/><br/>
Kreditornr: <xsl:value-of select="com:PaymentMeans/com:JointPaymentID"/><br/>
</xsl:when>
<xsl:when test = "com:PaymentMeans/com:PaymentChannelCode = 'DIRECT DEBET'">
Forfaldsdato: <xsl:value-of select="com:PaymentMeans/com:PaymentDueDate"/><br/>
Valutakode: <xsl:value-of select="udk:InvoiceCurrencyCode"/><br/>
Betalingstype: <xsl:value-of select="com:PaymentMeans/com:PaymentChannelCode"/><br/>
</xsl:when>
<xsl:when test = "com:PaymentMeans/com:PaymentChannelCode = 'NATIONAL CLEARING'">
Forfaldsdato: <xsl:value-of select="com:PaymentMeans/com:PaymentDueDate"/><br/>
Valutakode: <xsl:value-of select="udk:InvoiceCurrencyCode"/><br/>
Betalingstype: <xsl:value-of select="com:PaymentMeans/com:PaymentChannelCode"/><br/>
</xsl:when>
<xsl:otherwise>
Forfaldsdato: <xsl:value-of select="com:PaymentMeans/com:PaymentDueDate"/><br/>
Valutakode: <xsl:value-of select="udk:InvoiceCurrencyCode"/><br/>
Betalingstype: <xsl:value-of select="com:PaymentMeans/com:PaymentChannelCode"/><br/>
</xsl:otherwise>
</xsl:choose>
</font>
</td>
</tr>
</table>
<br/>
<xsl:if test="com:Note[.!='']">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td valign="top"></td>
<td valign="top"></td>
<td valign="top"></td>
<td valign="top"></td>
</tr>
<tr>
<td valign="top" colspan="4" bgcolor="#FFFFFF"><font face="Arial" size="2">
<!-- her indsættes fritekst -->
<b>Yderligere oplysninger:</b><br/>
<xsl:value-of select="com:Note"/><br/></font>
</td>
</tr>
</table>
</xsl:if>
</body>
</html>
</xsl:template>
<xsl:template match="com:InvoiceLine">
<tr>
<td width="17%" valign="top">
<font face="Arial" size="2">
<xsl:value-of select="com:Item/com:ID"/>
</font>
</td>
<td width="50%" valign="top">
<font face="Arial" size="2">
<xsl:value-of select="com:Item/com:Description"/>
</font>
</td>
<td width="10%" valign="top">
<font face="Arial" size="2">
<xsl:variable name="antal" select="com:InvoicedQuantity"/>
<xsl:value-of select="format-number($antal, '##0.00')"/>
</font>
</td>
<td width="10%" valign="top">
<font face="Arial" size="2">
<xsl:value-of select="com:InvoicedQuantity/@unitCode"/>
</font>
</td>
<td width="5%" valign="top">
<font face="Arial" size="2">
<xsl:variable name="enhedspris" select="com:BasePrice/com:PriceAmount"/>
<xsl:value-of select="format-number($enhedspris, '##0.00')"/>
</font>
</td>
<td width="3%" valign="top">
<font face="Arial" size="2">
</font>
</td>
<td width="13%" valign="top" align="right">
<font face="Arial" size="2">
<xsl:variable name="linietotal" select="com:LineExtensionAmount"/>
<xsl:value-of select="format-number($linietotal, '##0.00')"/>
</font>
</td>
</tr>
<tr>
<td valign="top"><font face="Arial" size="2"></font></td>
<td colspan="1" valign="top"><font face="Arial" size="1">
<xsl:if test="com:Item/com:SellersItemIdentification/ID[.!='']">
<b>Leverandørens varenr.: </b> <xsl:value-of select="com:Item/com:SellersItemIdentification/ID"/>
</xsl:if>
<xsl:if test="com:Item/com:CommodityClassification/com:CommodityCode[.!='']">
<b>UNSPSC code.: </b> <xsl:value-of select="com:Item/com:CommodityClassification/com:CommodityCode"/>
</xsl:if>
<xsl:if test="com:Note[.!='']">
<b>Note.: </b> <xsl:value-of select="com:Note"/>
</xsl:if>
</font></td>
<td valign="top"><font face="Arial"></font></td>
<td valign="top"><font face="Arial"></font></td>
<td valign="top"><font face="Arial"></font></td>
</tr>
<tr>
<td colspan="7" valign="top" height="8"><font face="Arial" size="1"></font>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>