xsl-list
[Top] [All Lists]

Project Organization

2005-09-19 20:42:20
Here's the details on a method of project organization I've adopted.

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:noun="tag:agtrz.com,2005-09:transform/nouns"
    >
  <xsl:import href="people.xslt"/>
  <xsl:import href="places.xslt"/>
  <xsl:template match="/">
    <xsl:apply-templates select="node()" mode="noun:transform"
  </xsl:template>
</xsl:stylesheet>


<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:ppl="tag:agtrz.com,2005-09:transform/nouns/people">
    xmlns:rt="tag:agtrz.com,2005-09:transform/nouns">

  <!--| Replace with transforms that create something. |-->
  <xsl:template match="node()" mode="ppl:transform"/>

  <xsl:template match="noun[(_at_)type = 'person']" mode="noun:transform">
    <xsl:apply-templates select="." mode="ppl:transform"/>
  </xsl:template>

</xsl:styleheet>

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:plc="tag:agtrz.com,2005-09:transform/nouns/places">
    xmlns:rt="tag:agtrz.com,2005-09:transform/nouns">

  <!--| Replace with transforms that create something. |-->
  <xsl:template match="node()" mode="plc:transform"/>

  <xsl:template match="noun[(_at_)type = 'place']" mode="noun:transform">
    <xsl:apply-templates select="." mode="plc:transform"/>
  </xsl:template>

</xsl:styleheet>

There seem to be benefits to this sort of modularity, even though it
looks simple enough to be pointless. Putting the logic in separate
mode namespaces helps. It seems to make matters cleaner that
namespaces are "localized". I'm finding myself creating ever smaller
XSLT files, some of which might include only a single template.

Ultimately, I can imagine how the root transform could be generated
via XSLT including the necessary templates.

What more can I do to organize XSLT? Project organization has been a
real challenge.

Thanks.

--
Alan Gutierrez - alan(_at_)engrm(_dot_)com
    - http://engrm.com/blogometer/index.html
    - http://engrm.com/blogometer/rss.2.0.xml

--~------------------------------------------------------------------
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>