xsl-list
[Top] [All Lists]

Re: XSL - Transforming 2 XSL stylesheets from 1 XML file

2005-05-05 05:52:35
"Craig" == craig webber <craigwebber(_at_)hotmail(_dot_)com> writes:

    Craig> In your case, it sounds like the medium should be
    Craig> sufficient - the desktop would be selected by coding
    Craig> media="screen", and the mobile device by
    Craig> media="handheld". You then invoke the XSLT transformer,
    Craig> saying (by means of it's API) which medium to target.  --

    Craig> --~------------------------------------------------------------------

    Craig> Paul, can you give me an example of how this would work?
    Craig> what is an XSLT transformer API?

My name is Colin.

API stands for Application Programming Interface.
So an XSLT transformer API is the method by which an application
program invokes an XSLT transformer.

If you are viewing the page through a web-browser, then it OUGHT to
select the correct the medium automatically.

I say OUGHT, because I have just tested Firefox with the following
files:

<?xml version="1.0" ?>
<?xml-stylesheet href="screen.xsl" type="application/xml" media="screen" 
charset="UTF-8" ?>
<?xml-stylesheet href="print.xsl" type="application/xml" media="print" 
charset="UTF-8" ?>
<data>
  <a/>
</data>

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; version="2.0">
  <xsl:template match="/" >
    <html xmlns="http://www.w3.org/1999/xhtml";>
      <body>
        <h1>Screen version</h1>
        <div>
          <p>Screen-rendered XHTML</p>
        </div>
      </body>
    </html>
  </xsl:template>
</xsl:transform>

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; version="2.0">
  <xsl:template match="/" >
    <html xmlns="http://www.w3.org/1999/xhtml";>
      <body>
        <h1>Print version</h1>
        <div>
          <p>Print-rendered XHTML</p>
        </div>
      </body>
    </html>
  </xsl:template>
</xsl:transform>

and it display the Print version on the screen, so clearly it is
non-compliant (the type ought to be application/xslt+xml, but Firefox
isn't recognising this - I know that for MSIE, you have to specify
type="text/xsl", which is HIGHLY non-compliant, as there is no such
mime-type).
-- 
Colin Paul Adams
Preston Lancashire

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--