xsl-list
[Top] [All Lists]

RE: [design question]

2003-02-07 16:53:04
-----Original Message-----
From: "Braumüller, Hans" [mailto:H(_dot_)Braumueller(_at_)hanseorga(_dot_)de]
Sent: Friday, February 07, 2003 2:32 AM
Subject: RE: [xsl] [design question]

<snip>
  That's similar to what we do, the difference being that 
your output code is
  inline, whereas we reference an external stylesheet that 
produces the
  javascript as plain text.
</snip>

The match and named templates are also included as external 
stylesheets in my case. The difference that everything (also 
css rules) is still with the method output=html. Have you 
encountered any difficulties outputting snippets of 
Javascripts or css as html ? At the end, html is also a 
plain/text format.

The output method just tells the processor how the result tree should be
serialized.  You should always use html as your output method if you want to
render HTML (if you use text, none of your markup will appear in the
output).  For external stylesheets producing CSS and JavaScript, your output
could be either text or html, depending on whether you need to use any
markup (unless you want to use the method described next, in which case you
have to use text output).

<snip>
  <script language="javascript" 
src="/trs/{$site}/components/common_js_library.xsl"/>
  ... etc ...
  So what you get is plain-text JavaScript ... 
</snip>

Do i understand correctly after transforming your xml you get 
following html snippet
  <script language="javascript" 
src="/trs/trip/components/common_js_library.xsl"/>
and this is recognized by the browser/client as valid html 
and javascript ?

Yes (although the close tag is written out as </script>).  Keep in mind that
we're doing two transformations: one to render the HTML page with the script
tag, then another to render the external JavaScript source.  The second
transformation is invoked when the client loads the file specified in the
src attribute of the script tag.  Setting either language="javascript" or
type="text/javascript" causes the browser to expect a plain-text file,
however, which is why your external stylesheet must use text as its output.

Cool, do you get it work also with css ?

We haven't tried that, but I don't see why it couldn't work.  I've built
dynamic CSS files before, using XML and WebMacro (a Java-based template
language), so I'm sure CSS rules could be provided in XML, and a text CSS
built from that using an XSLT stylesheet.

For example:  <style type="text/css" 
src="/style/display_properties.xsl">

Is that legal markup for referencing an external CSS?  I've always used:

<link rel="stylesheet" type="text/css" href="style/display_properties.xsl"
/>

But yes, if you handle your transformations on the server, the above should
work equally well.

cheers,
b.

| brian martinez                              
brian(_dot_)martinez(_at_)trip(_dot_)com |
| senior gui programmer                                  303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>