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] Include another XSL



Hi, there,

I want to seperate my JavaScript code into another XSL file(foo.xsl, for instance), 
rather than the one(main.xsl, for instance) I used to transforming XML into SVG.

Some code is like below:

1.foo.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet 	version="1.0" 
				xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
				xmlns:fo="http://www.w3.org/1999/XSL/Format"
				xmlns:msxsl="urn:schemas-microsoft-com:xslt"
				xmlns:foo="http://www.foo.com/"
				extension-element-prefixes="msxsl" >

<msxsl:script 	language="javascript"
				implements-prefix="foo"><![CDATA[

				function DoOnLoad(evt)
				{
				}

]]></msxsl:script>
</xsl:stylesheet>

2.main.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
				xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
				xmlns:foo="http://www.foo.com/"
				xmlns:fo="http://www.w3.org/1999/XSL/Format">
				
	<xsl:include href="foo.xsl"/>
	<xsl:output method="xml" 
				indent="yes" 
				doctype-public="-//W3C//DTD SVG 20000303 Stylable//EN" 
				doctype-system="http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd" 				version="1.0"
				encoding="ISO-8859-1"/>

	<xsl:strip-space elements="*"/>
	
	<xsl:template match="/">
		<xsl:apply-templates select="demo"/>
	</xsl:template>
	
	<xsl:template match="demo">
		<svg width="600" height="400" viewBox="0 0 600 400" xml:space="preserve" onload="foo:DoOnLoad( evt )">
			<desc/>
			<g id="contents">
				<rect id="bg" x="0" y="0" width="600" height="400" style="fill:#96b1da"/>
				<text style="font-size:18; text-anchor:middle" x="290" y="20">
					<xsl:value-of select="Caption"/>
				</text>
				<xsl:apply-templates select="device"/>
			</g>
		</svg>
	</xsl:template>
</xsl:stylesheet>

But in main.xsl, the onload="foo:DoOnLoad( evt )" doesn't work.
Anybody here know the reason? Very thanks.

--Bill