RE: [xsl] XSLT to summarise an XSLT

Subject: RE: [xsl] XSLT to summarise an XSLT
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Tue, 27 Aug 2002 09:35:10 -0700
Hi,

There was a post recently to a tool that creates javadoc-like output for XSLT.
That might be all you need.

We have a need to update or 'fix' XSL's. We first create an XML document that
describes the structure. Here is a snippet:

<xsl:template match="xsl:stylesheet">

   <stylesheet id="basic_1col.xsl">

    <doc>A basic 1 column layout. This is a primary stylesheet. Each primary
stylesheet includes global_definitions.xsl, which in turn includes the common
XSL pages. Much of the layout can be affected just by changing the
/css/project.css. When a page is requested/generated, a source XML (always
/WEB-INF/styling/site.xml) is transformed against a primary XSL.</doc>

    <doc>global_definitions.xsl includes the common XSL templates, gathers
parameters sent in
from  the server and sets up common global variables.</doc>
      <xsl:choose>
         <xsl:when test="boolean(xsl:include[@href='global_definitions.xsl'])">

            <include href="global_definitions.xsl" present="true"/>

         </xsl:when>
         <xsl:otherwise>

            <include href="global_definitions.xsl" present="false"/>

         </xsl:otherwise>
      </xsl:choose>


      <doc>Depending on the value of this variable paths will be built starting
from root relative if true, or document relative if falses.</doc>
      <xsl:choose>
         <xsl:when test="boolean(xsl:variable[@name='root_relative'])">

            <variable name="root_relative" select="{xsl:variable/@select}"
present="true"/>

         </xsl:when>
         <xsl:otherwise>

            <variable name="root_relative" select="{xsl:variable/@select}"
present="false"/>

         </xsl:otherwise>
      </xsl:choose>

      <doc>match the document root to start setting up the HTML page
structure</doc>
      <xsl:choose>
         <xsl:when test="boolean(xsl:template[@match='/'])">


            <template match="/" present="true">


               <xsl:choose>
                  <xsl:when test="boolean(xsl:template/html)">

                     <html present="true">
                        <doc>call to head.xsl to set up the HTML HEAD</doc>
                        <xsl:choose>
                           <xsl:when
test="boolean(xsl:template/html/xsl:call-template[@name='head'])">

                              <call-template name="head" present="true"/>

                           </xsl:when>
                           <xsl:otherwise>

                              <call-template name="head" present="false"/>

                           </xsl:otherwise>
                        </xsl:choose>
........etc......
-------------------------------------

Then this output is transformed to a report and or used to update/fix existing
XSL




> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of
> Macaulay,Malcolm (US)
> Sent: Tuesday, August 27, 2002 8:31 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] XSLT to summarise an XSLT
>
>
> I'm toying with the idea of making an XSLT to summarise a XSLT. My
> problem is a I have oddles of XSLTs which have the following characteristics:
>
>  - lots of common templates pulled in by xsl:includes
>  - lots of 'procedure' type templates with many parameters
>  - lots of conditional logic
>
> For purposes of enhancing/checking the XSLTs I think there would be
> some merit in having an XSLT which could pull all templates into one
> summarised output. XSLT is unwelding when you have template calls
> with parameters. Multiple includes make it time-consuming to locate a
> template.
>
> I'm thinking the output would look something closer to procedural
> code like VB.
>
> Has anyone done anything along this line? Any ideas or suggestions
> would be greatly appreciated.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread