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

Re: Invoking XSLT 2.0

Subject: Re: Invoking XSLT 2.0
From: "Rashmi Rubdi" <rashmi.sub@xxxxxxxxx>
Date: Sat, 28 Apr 2007 11:38:01 -0400
Re:  Invoking XSLT 2.0
On 4/28/07, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> I guess I'll be limiting myself if I relate to other
> languages because, it is possible to call separate named
> templates in the same XSL file from the command line, but
> with the main() method one can only call a single method and
> not other methods from the command line.

Well, in Java you can call the main() method of any public class, so it's
not quite that limited.

True. I was testing what would happen if the xsl:output method was omitted, according to the XSLT 2.0 reference book, the processor makes an intelligent guess and determines whether the output is html, xhtml otherwise the output is xml.

I was able to test the above with 1 stylesheet and 4 templates, and
was able to invoke each template from the command line.

-------------------------------------------------------------
1 stylesheet with 4 named templates.
-------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<!-- in this case the XML prolog is omitted -->
	<xsl:template name="htmlLikeOutput">
		<html>
			<head></head>
			<body>
				<p>The rain in spain</p>
				<p>stays mainly on the plain</p>
				<hr/>
				<!-- Unescaped special character &, not allowed unless it is
inside a cdata -->
				Escaped special character &amp;
			</body>
		</html>	
	</xsl:template>

	<xsl:template name="xhtmlLikeOutput">
		<html xmlns="http://www.w3.org/1999/xhtml">
			<head></head>
			<body>
				<p>The rain in spain</p>
				<p>stays mainly on the plain</p>
				<hr/>
				<!-- Unescaped special character , not allowed & -->
				Escaped special character &amp;
				<!-- View Source in browser -->
			</body>
		</html>	
	</xsl:template>
	
	<xsl:template name="xmlLikeOutput">
		<somenode>
			<innernode>
				<sometext>
				<!--Unescaped special character & -->
				Escaped special character &amp;				
				</sometext>
			</innernode>
		</somenode>
	</xsl:template>

	<xsl:template name="textLikeOutput">
		comman, separated, tokens, test, hello, world
		<!--Unescaped special character & -->
		Escaped special character &amp;		
	</xsl:template>
	
</xsl:stylesheet>

-----------------------------------------------------------------
command line
-----------------------------------------------------------------
java -jar c:\dev\saxonb8-9-0-3j\saxon8.jar -it xmlLikeOutput
ouput_method_none.xsl > output1.xml

java -jar c:\dev\saxonb8-9-0-3j\saxon8.jar -it htmlLikeOutput
ouput_method_none.xsl > output1.xml

java -jar c:\dev\saxonb8-9-0-3j\saxon8.jar -it xhtmlLikeOutput
ouput_method_none.xsl > output1.xml

java -jar c:\dev\saxonb8-9-0-3j\saxon8.jar -it textLikeOutput
ouput_method_none.xsl > output1.xml

Current Thread

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
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-2011 All Rights Reserved.