[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xsl/xslt coding standard
MJ> Is there any existing xsl/xslt coding standard? MJ> How do you build and format your xsl stylesheets? I am unaware of a standard, but I recently spent some amount of time putting something together that works for me. The net result is that I write and "compile" my stylesheets in MSDEV, using a custom build step, as follows: i) create XSLT "source" as an .stm file. The choice of the file type is arbitrary, but .stm results in reasonable syntax coloring within the MSDEV editor and most external editors. ii) create a custom build step in MSDEV as follows: cl /EP /DXSL /D_DEBUG /I$<addt'l include folders here> $(InputPath) > $(IntDir)\$(InputName).xso more /S /T4 $(IntDir)\$(InputName).xso > $(ProjDir)\tools\$(InputName).xsl The first command ("cl") performs a C preprocessor pass on the .stm file, producing a temporary ".xso" file. The second command ("more") merges multiple subsequent empty lines (a by-product of CL) and replaces all tab characters neatly with spaces (tabwidth 4), resulting in the .xsl file. What I get out of this? 1. I share C preprocessor definitions (the XML markup) between the (C++) tool that generates the XML, and the stylesheets that use the XML. 2. I can use C preprocessor macros as a shorthand for repetitive tasks. 3. I build a "debug" and a "release" version of the templates (see /D_DEBUG parameter to CL), allowing for additional tracing output 4. I get three kinds of comments: <xsl:comment> for comments that appear in the rendered HTML, <!-- --> comments for comments that appear in the generated stylesheets, and C++ comments (//....) that only appear in the source file. I use the latter for notes for myself and fellow developers. A bitter pill is that included headerfiles may have to be specially prepared for being shared between C/C++ and XSLT projects. The XSL macro (see /DXSL) is used for conditional header file content. For example: #if !defined(XSL) typedef {.....} #endif // !XSL Works fab for me, and certainly makes my project more manageable for myself and future fellow developers. I'd be interested to hear what others do. Bernd -- Bernd Gauweiler mailto:bernd@xxxxxxxxxxxxx -- XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|