Click here to Skip to main content
12,512,689 members (28,139 online)
Click here to Skip to main content

Stats

21K views
287 downloads
42 bookmarked
Posted

Document and Code Generation by LINQ and XSL

, 3 Aug 2008 CPOL
An article on how to generate source code as well as populate Excel Spreadsheets.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
					   xmlns:msxsl="urn:schemas-microsoft-com:xslt"
					   xmlns:user="urn:my-scripts">

	<msxsl:script language="C#" implements-prefix="user">
		
		<msxsl:assembly href="..\Some.Other.Library\Bin\Debug\Some.Other.Library.dll" />
		<msxsl:using namespace="Some.Other.Library.Test.Code"/>
		
		<![CDATA[
		public string Area(int length)
		{
			int square = length * length;

			Helper helper = new Helper();
			
			return (
				helper.Print("The Length Of A Square Is:", length) + "\n" + 
				helper.Print("The Area Of A Square Is:  ", square)
				);
		}
        ]]>

	</msxsl:script>

	<xsl:template match="data">
		<xsl:value-of select="user:Area(.)"/>
	</xsl:template>
	
</xsl:stylesheet>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Dave Elliott
Software Developer (Senior) Webbert Solutions
United States United States
Dave is an independent consultant working in a variety of industries utilizing Microsoft .NET technologies.

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160929.1 | Last Updated 3 Aug 2008
Article Copyright 2008 by Dave Elliott
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid