
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Passing Parameters to XSLT Transformations
|
873
Using the GenerateSchemaForDirectory method can jump-start the process of devel-
oping schema for your XML, but each schema should be reviewed by the team mem-
ber responsible for producing the XML. This will help to ensure that the rules as
stated in the schema are correct and also to make sure that additional items like
schema default values and other relationships are added. Any relationships that were
not present in the example XML files would be missed by the schema generator.
See Also
See the “XmlSchemaInference Class” and “XML Schemas (XSD) Reference” topics in
the MSDN documentation.
15.14 Passing Parameters to XSLT Transformations
Problem
You need to use XSLT to produce information that has a few data items that could
change between transformations and you don’t want to have a separate XSLT
stylesheet for each variation.
Solution
Use the XsltArgumentList class to pass arguments to the XSLT transformation. This
technique allows the program to generate an object for the stylesheet to access (such
as a dynamic string) and use while it transforms the given XML file. The
storeTitle
and pageDate arguments are passed in to the transformation in the following exam-
ple. The
storeTitle is for the title of the comic store and pageDate is the