This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
?MSXML transformNode
- To: xsl-list at mulberrytech dot com
- Subject: ?MSXML transformNode
- From: Serg Stone <serg_stone at iname dot com>
- Date: Wed, 9 Aug 2000 08:32:46 +0400
- Organization: InterResource
- Reply-To: xsl-list at mulberrytech dot com
Hello, All
Can anybody help me with MS XSLT???
I have XML file and XSLT file that converts it into HTML. The result
is simple HTML table. It has <COL> specifications for all columns. For
some columns <COL align="right"> is used.
When I apply transformNode() function to the table right align is
changed by simple left align. Is it a bug or feature of MSIE?
Can anyone test if it is problem of mine?
Following is an example.
=============
XML-file:
<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="test.xsl" ?>
<tbl>
<tbl_head>
<tbl_row>
<c0>Col0</c0>
<c1>Col1</c1>
</tbl_row>
</tbl_head>
<tbl_col>
<tbl_row>
<c0 />
<c1 />
</tbl_row>
</tbl_col>
<tbl_body>
<tbl_row>
<c0>4</c0>
<c1>1</c1>
</tbl_row>
<tbl_row>
<c0>2</c0>
<c1>3</c1>
</tbl_row>
</tbl_body>
</tbl>
=========================
XSL file:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
<xsl:template match="/">
<HTML>
<SCRIPT><xsl:comment><![CDATA[
function on_head_click(){
//alert('sdfg');
tbl.innerHTML=source.documentElement.transformNode(stylesheet);
}
]]></xsl:comment></SCRIPT>
<SCRIPT for="window" event="onload"><xsl:comment><![CDATA[
stylesheet=document.XSLDocument;
source=document.XMLDocument;
]]></xsl:comment></SCRIPT>
<BODY bgcolor="threedface" topmargin="0" leftmargin="0">
<DIV id="tbl"><xsl:apply-templates select="tbl" /></DIV>
</BODY>
</HTML>
</xsl:template>
<!--==-->
<xsl:template match="tbl">
<span style='background-color:#777777'>
<TABLE id="lines" border="1" align="center" bordercolor="#bbbbbb" cellpadding="0" cellspacing="1">
<xsl:apply-templates select="tbl_head" />
<xsl:apply-templates select="tbl_col" />
<xsl:apply-templates select="tbl_body" />
</TABLE>
</span>
</xsl:template>
<xsl:template match="tbl_head">
<xsl:apply-templates select="tbl_row" />
</xsl:template>
<xsl:template match="tbl_head/tbl_row">
<TR>
<xsl:for-each select="*">
<TH>
<xsl:attribute name="onClick">on_head_click()</xsl:attribute>
<xsl:value-of select="." />
</TH>
</xsl:for-each>
</TR>
</xsl:template>
<xsl:template match="tbl_col">
<xsl:apply-templates select="tbl_row" />
</xsl:template>
<xsl:template match="tbl_col/tbl_row">
<TR>
<xsl:for-each select="*">
<COL align="right">
<xsl:value-of select="." />
</COL>
</xsl:for-each>
</TR>
</xsl:template>
<xsl:template match="tbl_body">
<xsl:apply-templates select="tbl_row" />
</xsl:template>
<xsl:template match="tbl_body/tbl_row">
<TR>
<xsl:for-each select="*">
<TD>
<xsl:value-of select="." />
</TD>
</xsl:for-each>
</TR>
</xsl:template>
</xsl:stylesheet>
==============================
--
Best regards,
Serg mailto:serg_stone@iname.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list