[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xsl and xml and javascript. argh!!!!!!!

  • From: "Birney, Kenneth" <Kenneth.Birney@s...>
  • To: "'xml-dev@l...'" <xml-dev@l...>
  • Date: Tue, 06 Nov 2001 10:10:17 +0000

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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.