[Javascript] Off Topic, CSS and XML Question- this message is in text format

charlie_chan charlie_chan at cox-internet.com
Mon May 9 22:06:02 CDT 2005


charlie_chan wrote:

>The reason I posted the page here is that anyone who does
>a lot of work with browsers has to deal with XML.
>
>Does IE6 support CSS in a .xsl file? I've got .xml, .dtd,
>and a .xsl files, but the .xsl file has no effect on the
>formating of the XML document display which does display.
>It is copied straight out of the book, so the code should
>be correct.
>
>Here is the XSL page:
><?xml version='1.0'?>
><xsl:stylesheet xmlns:xsl="http............."> removed link for posting
><xsl:template match="/">
> <HTML>
>  <HEAD>
>   <TITLE>A Test</TITLE>
>  </HEAD>
>  <BODY>
>   <xsl:for-each select="story/section">
>   <p 
>   style = "font-family:sans-serif; padding-top:20px; font-size:20px">
>   </p>
>   <xsl:value-of />
>   </xsl:for-each>
>  </BODY>
> </HTML>
></xsl:template>
></xsl:stylesheet>
>
>The XML page contains the correct reference to the XSL page:
><?xml-stylesheet type ="text/css" href="story.xsl"?>
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>
>  
>
I finally worked out the issue I was having with CSS, XML, and XSLT.  
Here is a page
from my project which shows what I did with it.  However, I am now 
trying to put a
button in the XSLT file that will play a tune when pressed using 
JavaScript.  So far,
all I get is Object Required.  Here is the XSLT file and the CSS file.

Trans_Authors.xsl
<?xml version="1.0"?>  <!-- EACH TRANSFORMATION PAGE USES A DIFFERENT 
APPOACH -->
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxsl="urn:schemas-microsoft-com:xslt" > 
<xsl:output method="html" indent="yes" />

<!--
This was NOT a fairly simple XSLT page for me.  It creates a node in the 
source
tree from a separate XML document and then it sorts the node and 
displays the
results using HTML.  However, the coding was very time comsuming due to the
fact that as each author is display, the item's (book's) attributes 
(sub-elements)
are then displayed which includes all of the books authors.  The authors 
could
also use a better sortation than resulted from my efforts.
-->

<xsl:template match="/">

<html>
<bgsound src="chpv65[1].wav" class="intro" />
    <link rel="stylesheet" type="text/css" href="my_bookstyle.css" />
<title>MY LIBRARY - SORTED BY AUTHORS</title>
<body>
     <table>
    <!-- The is the Sortation Option section. -->
    <tr align="right"><td>BOOKS SORTED BY AUTHOR</td>
        <td><img src="./CharlieChan_bw2.jpg" /></td></tr>
    <tr><td align="left"><a href="mainPage.xml" > Sort by Title </a></td>
        <td align="right"><a href="mainSubject.xml">Sort by Subject 
</a></td></tr>
     </table>

    <xsl:element name="br" />
    <!-- Example of using the document( ) to include a source tree from 
a separate XML document -->
    <xsl:for-each select="document('data.xml') 
/data/item/authors/author/LName" >
        <!-- The path used for sort is important.  It is repeated in the 
following template.-->
        <xsl:sort data-type="text" order="ascending" 
select="normalize-space(ancestor::author/LName)" />
        <table>
            <xsl:element name="tr">
                <xsl:attribute name="class">highlightBlue</xsl:attribute>
            <xsl:element name="td">
                <!-- Note how a space was added after each part of a 
name. -->
                <!-- amp. pound-sign 032; = single space and 160 is 
double space -->
                <!-- amp. pd-sign 032 does not work in FireFox -->
                <p>
                <xsl:value-of select="ancestor::author/FName" /> 
<xsl:value-of select="' '" />
                <xsl:value-of select="ancestor::author/MName" /> 
<xsl:value-of select="' '" />
                <xsl:value-of select="ancestor::author/LName" /> 
<xsl:value-of select="' '" />
                <xsl:value-of select="ancestor::author/degree" />
                <xsl:value-of select="*/*" />
                </p>
            </xsl:element> </xsl:element>
        </table>
        <xsl:value-of select="*/*" /> <!-- Notice how this line of code 
ends -->
        <xsl:call-template name="aTable" />
    </xsl:for-each>
</body>
</html>
</xsl:template>

<!--
I used HTML tags instead of XSLT element tags to display the data in 
this table
because it is easier to work with when using a CSS document.
-->
<xsl:template name="aTable">
<xsl:element name="table">
    <tr class="highlightBeige"><td>TITLE</td><td><xsl:value-of 
select="ancestor::item/title" /> </td></tr>
    <tr><td>EDITION</td><td><xsl:value-of 
select="ancestor::item/edition" /></td></tr>
    <tr><td>COPYRIGHTED</td><td><xsl:value-of select="copyrighted" 
/></td></tr>
    <xsl:for-each select="ancestor::authors/author/LName">
        <xsl:sort data-type="text" order="ascending" 
select="normalize-space(ancestor::authors/author/LName)" />
        <tr><td class="aBorderML">AUTHOR/s</td><td class="aBorderMR">
            <xsl:value-of select="ancestor::author/FName" /> 
<xsl:value-of select="' '" />
            <xsl:value-of select="ancestor::author/MName" /> 
<xsl:value-of select="' '" />
            <xsl:value-of select="ancestor::author/LName" /> 
<xsl:value-of select="' '" />
            <xsl:value-of select="ancestor::author/degree" /></td></tr>
            <xsl:value-of select="*/*" />
    </xsl:for-each>
    <tr><td>PUBLISHER</td><td><xsl:value-of 
select="ancestor::item/publisher" /></td></tr>
    <tr><td>ISBN</td><td><xsl:value-of select="ancestor::item/isbn" 
/></td></tr>
    <tr><td>LCCN</td><td><xsl:value-of select="ancestor::item/lccn" 
/></td></tr>
    <tr><td>PRICE</td><td><xsl:value-of select="ancestor::item/price" 
/></td></tr>
    <tr><td class="aBorderBL">SUBJECT</td><td class="aBorderBR"><p>
        <xsl:value-of select="ancestor::item/subject" /></p></td></tr>
</xsl:element>
<br />
</xsl:template>
</xsl:stylesheet>
<!-- Charlie Chan at charlie_chan at cox-internet.com -->
===========================================

my_bookstyle.css
body { font-family: Arial, Helvetica, sans-serif; }
.intro { pause-after: 3; richness: 90; volume: x-loud; }
A:link { color: #000000; text-decoration: underline;}
A:visited { color: #336699; text-decoration: underline;}
A:hover { color: #CC9900; text-decoration: underline;}
table { width: 60%; border-style: ridge; border-width: 6px; }
.highlightBlue {background-color:#B9EAFF; }
.highlightBeige {background-color:beige; }
.borderSilver { border-color:#C0C0C0; }
* { font-size: 16px; }
.aBorderBL { border-top-width: 4px; border-right-width: 4px; 
border-top-style: dashed; border-right-style: dashed; }
.aBorderBR { border-top-width: 4px; border-top-style: dashed; }
.aBorderTL { border-bottom-width: 4px; border-bottom-style: dashed; 
border-right-style: dashed; border-right-width: 4px; }
.aBorderTR { border-bottom-width: 4px; border-bottom-style: dashed; }
.aBorderML { border-bottom-width: 2px; border-bottom-style: solid; 
border-right-width: 2px; border-right-style: solid;
    border-top-width: 2px; border-top-style: solid; }
.aBorderMR { border-bottom-width: 2px; border-bottom-style: solid; 
border-top-width: 2px; border-top-style: solid; }




More information about the Javascript mailing list