开发者

XSLT Not Rendering HTML

开发者 https://www.devze.com 2023-02-19 20:38 出处:网络
I have a XSLT document that I am trying to edit so that it will show the HTML correctly rather than showing the actual HTML tags.Below is a snipet of part of the XSLT and the HTML.When the page is ren

I have a XSLT document that I am trying to edit so that it will show the HTML correctly rather than showing the actual HTML tags. Below is a snipet of part of the XSLT and the HTML. When the page is rendered is shows the HTML tags instead of rendering them. Any help would be much appreciated. Sorry about the code being on one line. I couldn't figure out how to get it to work if it was formatted on multiple lines.

<!-- Test Template -->
<xsl:template match="TestTemplate">
    <table border="0" width="100%">
        <tr>
            <td>
                <font
                    style='font-family:Tahoma, Verdana, Geneva, sans-serif;
        font-size:14px; color:#c41130'>
                    <b>
                        <xsl:value-of select="Title" />
                    </b>
                </font>
            </td>
        </tr>
    </table>
    <table border="0">
        <tr>
            <td class="Label">
                <font style="color:#333333">
                    <b>Title</b>
                </font>
            </td>
            <td>
                <font style="color:#333333">
                    <xsl:value-of select="Title" />
                </font>
            </td>
        </tr>
        <tr>
            <td class="Label">
                <font style="color:#333333">
                    <b>Department</b>
                </font>
            </td>
            <td>
                <font style="color:#333333">
                    <xsl:value-of select="Department" />
                </font>
            </td>
        </tr>
        <tr>
            <td class="Label">
                <font style="color:#333333">
                    <b>Type</b>
                </font>
            </td>
            <td>
                <font style="color:#333333">
                    <xsl:value-of select="JobType" />
                </font>
            </td>开发者_开发问答
        </tr>
    </table>
    <table border="0" width="100%">
        <tr>
            <td class="line">
                <img src="/img/s.gif" height="1" width="1" />
            </td>
        </tr>
        <tr>
            <td>
                <img src="/img/s.gif" height="5" width="1" />
            </td>
        </tr>
    </table>
    <xsl:if test="(Description)">
        <br />
        <font
            style='font-family:Tahoma, Verdana, Geneva, sans-serif;
            font-size:14px; color:#c41130'>
            <b>Description</b>
        </font>
        <br />
        <xsl:apply-templates select="Description/Line" />
        <br />
    </xsl:if>
    <br />
</xsl:template>

Test HTML that is showing the html tags instead of rendering them.

<b>TEST HEADING</b>
<ul>
    <li></li>
    This should be a list.
</li>
    <li>This should be a list.</li>
    <li>This should be a list.</li>
    <li>This should be a list.</li>
    <li>This should be a list.</li>
    <li>This should be a list.</li>
</ul>


Where are you attempting to transform/display your input/output? In a browser? The default output method for XSLT is XML, but you can specify HTML with the following:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>
    <!-- other XSLT goes here -->
</xsl:stylesheet>

In, Firefox, for example, this results in a rendering of the output as a webpage.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号