0
votes

I've got the following two xml files:

The xml where my xslt gets its content from:

<?xml-stylesheet type='text/xsl' href='report.xsl'? encoding='UTF-8'? version="1.0">

<configuration version="1.0">
  <profession id="DENT">
    <applicationType id="DENT AGREE_STD_DS_TRAINING_PLAN">
        <discipline id="306"/>
        <document id="DIPL"/>
        <document id="STGEPL"/>
    </applicationType>
  </profession>

  <description type="profession" id="MED">
    <documentation language="NL">Geneesheer</documentation>
    <documentation language="FR">Médicin</documentation>
  </description>

The XSTL document:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:template match="/">
    <html>
        <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <title>TS
                <xsl:value-of select="//ts/@name"/>
            </title>
            <style>
                body {background-color: #202020; color:white;font-family: verdana;}
                h1 {color: white; font-size:24}
                h2 {color: #606060; font-size:18}
                h3 {color: #B40404; font-size:16}
                p {font-size:16}
                tr.passed td{background-color: green; color: white}
                .passed {background-color: green; color: white}
                tr.failed td{background-color: red; color:white}
                .failed {background-color: red; color:white}
                tr.blocked td{background-color: gold}
                .blocked {background-color: gold}
                a {color:#CEE3F6}
            </style>
        </head>
        <body>
            <h1>XSD</h1>
            <div id="xsd"></div>
            <h1>Structure document</h1>
            <ul>
                <xsl:apply-templates select="/configuration/profession"/>
            </ul>

            <ul>
                <xsl:apply-templates select="/configuration/description"/>
            </ul>

            <div>
                Some content!
            </div>
        </body>
    </html>
</xsl:template>

<xsl:template match="//profession">
    <li>
        <p>
            <a href="">
                Profession:
                <xsl:value-of select="@id"/>
            </a>
        </p>
        <ul>
            <xsl:apply-templates select="./applicationType"/>
        </ul>
    </li>

</xsl:template>

<xsl:template match="//applicationType">
    <li>
        <p>
            <a href="">
                Application type:
                <xsl:value-of select="@id"/>
            </a>
        </p>
        <ul>
            <xsl:apply-templates select="./discipline"/>
            <xsl:apply-templates select="./document"/>
        </ul>
    </li>
</xsl:template>

<xsl:template match="//discipline">
    <li>
        <p>
            <a href="">
                Discipline:
                <xsl:value-of select="@id"/>
            </a>
        </p>
    </li>
</xsl:template>


<xsl:template match="//document">
    <li>
        <p>
            <a href="">
                Document:
                <xsl:value-of select="@id"/>
            </a>
        </p>
    </li>
</xsl:template>

<xsl:template match="//description">
    <li>
        <p>
            <a href="">
                description:
                <xsl:value-of select="@type"/>
            </a>
        </p>
    </li>
</xsl:template>

So there is nothing special about this, but as you can see I want to open the XML in the browser and I can do this, but the problem is encoding. I thought UTF-8 supported characters with accents (see médicin). But it gives me an error when I'm opening it.

Any idea what I'm doing wrong or what encoding I should choose?

1

1 Answers

0
votes

Alright.. I created the file in notepad (since it was just a copy past) but the file itself wasn't encoded in UTF-8. I saved it with notepad++ and it was ok.