Re: [xsl] XSL Contextual formatting of links

Subject: Re: [xsl] XSL Contextual formatting of links
From: "cking" <cking@xxxxxxxxxx>
Date: Mon, 9 Aug 2004 18:25:50 +0200
BTW, it's a pity too that the stylesheet only works in IE:
With a few small modifications, it would also work in Netscape/Mozilla (maybe other browsers too):

1. add the default (html) namespace to the xsl:stylesheet element:

  <xsl:stylesheet version="1.0"
    xmlns="http://www.w3.org/1999/xhtml";
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

2. replace your xsl:output by:
  <xsl:output
    method="xml"
    version="1.0"
    encoding="iso-8859-1"  ---(or the encoding you want to use)
    indent="yes"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
    />

3. In the root template, wrap a html/body element around the table:
  <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml";>
      <head>
        <title><xsl:value-of select="title"/></title>
      </head>
      <body>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
          ....
        </table>
      </body>
    </html>
  </xsl:template>

I used the "XHTML 1.0 Strict" doctype here, in which case you will also have to
change some attributes (eg. <table style="width:100%;"... instead of
<table width="100%"...)
Or, if you prefer, you could use XHTML Transitional

Best regards
Anton Triest


From: "Paul Hiles" 
> I've been struggling to add hyperlinks into a particular area
> (related-items)
> on a page. If you check out the following page:
> http://www.erimus.com/temp/xml/003_page_sample.xml
> you'll see that the "description/list/items" now contain hyperlinks.
> 
> Just one niggly bug remains.. I'm trying to prevent duplication of the link
> and its text value! At the moment, if I start the list item with a link then
> you will see the plain text from the link, as well as the link itself
> immediately to its right. I'm sure there's a conditional statement I can add
> to the XSL stylesheet to ensure these instances are correctly rendered, but
> I'm not sure what they are. Can anyone help me out with this?

Current Thread