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]

[xml-dev] xsl and xml and javascript. argh!!!!!!!



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. 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.