I just learning WPF and silverlight. I'm trying to generate WPF and silverlight apps via XSLT. I have observed that the only differnence between my WPF XAML file and my Silverlight XAML file is that WPF uses the windows tag (as the first tag) and Silverlight uses the Page tag (as the first tag) and the Silverlight viewer uses the canvas tag (as the first tag). Everything else (for WPF and silverlight anyway) is identical. The silverlight viewer file is a little different in the sense it cannot have references to C# in it. So a question for the silverlight form is: do I need otherwise identical files for WPF and Silverlight. I posted this quesiton and I think the response is "yes" (but I'm not completely certain). So do I have to maintain three otherwise identical XSL files? Ugghh... So here is the XSL question: Is there a way I can pass a parameter (or something) so it will generate a page tag, windows tag, or canvas tag so I don't have to maintain three otherwise identical XSL files? Thanks! Siegfried
Siegfried Heintze wrote: > So here is the XSL question: > Is there a way I can pass a parameter (or something) so it will generate a > page tag, windows tag, or canvas tag so I don't have to maintain three > otherwise identical XSL files? You can write stylesheet modules and compose them using xsl:include or xsl:import, see http://www.w3.org/TR/xslt#section-Combining-Stylesheets That might already suffice to avoid having three huge, nearly identical stylesheets, instead you would simply put the identical part into a huge module and then write three other small ones that include or import the module. If you want to work with a parameter then that is also possible, you can define a global parameter (e.g. root-name) in your stylesheet e.g. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:param name="root-name" select="'window'"/> <xsl:template match="/"> <xsl:element name="{$root-name}"> ... </xsl:element> </xsl:template> ... </xsl:stylesheet> and then you would use a (processor specific) way to set the parameter root-name to e.g. 'window' or 'page' before you run the transformation. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/