xsl-list
[Top] [All Lists]

XSLT for Extensibility

2005-01-29 11:47:34
    How does one design in XSLT for extensibility?

    I know how to design an API, but not on in XSLT.

    I'm not sure how to ask the question. So I'll try an example.

    (I'm not really looking for a build solution, but an XSLT as API
        discussion.)

    --
    
    Let's say you have a file that's a project.

    <project>
      <source>
        <name>main</name>
        <dir>src/main</dir>
        <category>dist</category>
      </source>
    </project>

    Project directory:
      
      /project
          /src
              /java
              /resource

    Use the above to generate an Ant script.

    You could transform the project document into simple javac,
    junit, javadoc, and jar tasks.

    How do you allow the user to plug in new tasks?

    This is a general problem I'm having, how do you create hooks,
    callbacks, er, how do you create an XSLT framework? 

    --

    I asked elsewhere, and pipelines were suggested, so I'll permit
    myself two steps.
    
    Here's a notion.

    <project>
    
      <name>foo</name>

      <source>
        <name>main</name>
        <dir>src/main</dir>
        <category>dist</category>
      </source>

      <task>
        <name>javac</name>
        <name>javadoc</name>
        <name>antlr</name>
        <name>jar</name>
      </task>

    </project>

    I can transform the above into a script that looks like:

    <xsl:stylesheet>

      <xsl:import href="taskdef/javac.xslt"/>
      <xsl:import href="taskdef/javadoc.xslt"/>
      <xsl:import href="taskdef/antlr.xslt"/>
      <xsl:import href="taskdef/jar.xslt"/>

      <xsl:template match="project">

        <project name="foo" default="default">
          
          <xsl:apply-templates select="." mode="javac"/>
          <xsl:apply-templates select="." mode="javadoc"/>
          <xsl:apply-templates select="." mode="antlr"/>
          <xsl:apply-templates select="." mode="jar"/>
            
        </project>

      </xsl:template>

    </xsl:stylesheet>

    Then I can use that stylesheet as the the style to transform my
    project into an Ant build file. 

    What other methods are there for creating a a pluggble XSLT
    framework?

--
Alan Gutierrez - alan(_at_)engrm(_dot_)com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>