OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xml-dev] updated xml, javascript and xsl problemo.




I'm assuming you're using IE and MSXML4.

So here's your problems:

1. 'xsl:Stylesheet' should be changed to 'xsl:stylesheet'
2. The 'mach' attribute should be changed to 'match'
3. Get rid of the 'XML' element in your stylesheet
4. Make this the first line of the init() javascript function:
       var testXML = new ActiveXObject("msxml2.domdocument");

-Wayne Steele



>From: "Birney, Kenneth" <Kenneth.Birney@spis.police.uk>
>To: "'xml-dev@lists.xml.org'" <xml-dev@lists.xml.org>
>CC: "'xml-dev@lists.xml.org'" <xml-dev@lists.xml.org>
>Subject: [xml-dev] updated xml, javascript and xsl problemo.
>Date: Tue, 06 Nov 2001 10:16:24 +0000
>
>here's the problem im having:
>
>im trying to use and xsl document to transform data in an XML document into
>HTML. Simple enough. However, im also using the XSL document (with
>Javascript) to format the HTMl page i.e. Text size, color ect, by taking
>values from another XMl document. a sort of xml coniguration file. However
>the document just turns out as blck, no text. why? The code for the three
>files is below:
>
><?xml version="1.0" ?>
><UICONFIG>
>	<config>
>		<backcolor>#000000</backcolor>
>		<fontcolor>#ff0000</fontcolor>
>		<fontsize>Large</fontsize>
>	</config>
>
></UICONFIG>
>
><?xml version="1.0"?>
><xsl:Stylesheet version = "1.0"
>xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
><xsl:output method="html"/>
>
><xsl:template mach="/">
>	<html>
>	<head>
>	<title> Fromatted data through xsl, 2 xml documents and Javascript
></title>
>	</head>
>	<body onload = "init()" id="body">
>
>	<SCRIPT LANGUAGE="javascript">
>			function init()
>			{
>				testXML.async = false;
>				testXML.load("./ui.xml");
>
>				formatUI(testXML);
>			}
>
>			function formatUI(testXML)
>			{
>				i = 0;
>				itemElement =
>testXML.documentElement.childNodes.item(i);
>				document.bgColor =
>itemElement.childNodes.item(0).childNodes.item(0).nodeValue;
>				document.fgColor =
>itemElement.childNodes.item(1).childNodes.item(0).nodeValue;
>				document.all.body.style.fontSize=
>itemElement.childNodes.item(2).childNodes.item(0).nodeValue;
>			}
>
>	</SCRIPT>
>
>	<xsl:apply-templates select="//Person"/>
>
>	</body>
>
>	<XML ID="testXML">
>	</XML>
>
>	</html>
></xsl:template>
>
><xsl:template match ="Person">
>	<H1> <xsl:value-of select = "Name"/> </H1>
>	<b>  <xsl:value-of select = "Job" /> </b>
>	<p> <xsl:value-of select = "Details"/> </p>
></xsl:template>
>
></xsl:Stylesheet>
>
><?xml version="1.0" standalone = "yes"?>
><?xml-stylesheet type="text/xsl" href="UIConfigStyle.xsl" ?>
><data>
>	<Person>
>		<Name> Kenny Birney </Name>
>		<Job> Programmer </Job>
>		<Details> This data has been transformed into HTML through
>xsl and formatted through JavaScript and xml </Details>
>	</Person>
></data>
>
>Thanks for your help
>
>Kenny Birney.
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp