[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSL Dependency Mapping

Subject: RE: XSL Dependency Mapping
From: Américo Albuquerque <melinor@xxxxxxx>
Date: Thu, 24 Jul 2003 18:38:21 +0100
self xsl
Hi

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Andy Joslin
> Sent: Thursday, July 24, 2003 8:00 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  XSL Dependency Mapping
> 
> 
> Hi All
> 
> Does anyone know of a tool that can generate a dependency map 
> of a whole set of XSL's ? (i.e. which stylesheets import others, etc.)
> 
> A tool that generated some kind of site map/tree of related 
> XSLs would be great as I'm trying to clean up and reign in 
> some 400 files with a view to finding common dependencies, etc.
> 
> Does XML Spy have this feature ?

You could do that with xslt.

Try these templates:

  <xsl:template match="xsl:stylesheet">
    <xsl:text>Mappings&#10;</xsl:text>
    <xsl:text>--+&#10;</xsl:text>
    <xsl:text>&#160;&#160;|&#10;</xsl:text>
    <xsl:apply-templates select="*[self::xsl:include or self::xsl:import]"/>
    <xsl:text>&#10;</xsl:text>
  </xsl:template>

  <xsl:template match="xsl:include">
    <xsl:param name="sep" select="'&#160;&#160;'"/>
    <xsl:variable name="nxt">
      <xsl:choose>
        <xsl:when test="following-sibling::*[self::xsl:include or
self::xsl:import][1]">
          <xsl:value-of select="'|'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'&#160;'"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:value-of select="concat($sep,'|&#10;')"/>
    <xsl:value-of select="concat($sep,'+-')"/>
    <xsl:value-of select="@href"/>
    <xsl:text> (include)</xsl:text>
    <xsl:text>&#10;</xsl:text>
    <xsl:apply-templates
select="document(@href)/xsl:stylesheet/*[self::xsl:include or
self::xsl:import]">
      <xsl:with-param name="sep" select="concat($sep,$nxt,'&#160;')"/>
    </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="xsl:import">
    <xsl:param name="sep" select="'&#160;&#160;'"/>
    <xsl:variable name="nxt">
      <xsl:choose>
        <xsl:when test="following-sibling::*[self::xsl:include or
self::xsl:import][1]">
          <xsl:value-of select="'|'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'&#160;'"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:value-of select="concat($sep,'|&#10;')"/>
    <xsl:value-of select="concat($sep,'+-')"/>
    <xsl:value-of select="@href"/>
    <xsl:text> (import)</xsl:text>
    <xsl:text>&#10;</xsl:text>
    <xsl:apply-templates
select="document(@href)/xsl:stylesheet/*[self::xsl:include or
self::xsl:import]">
      <xsl:with-param name="sep" select="concat($sep,$nxt,'&#160;&#160;')"/>
    </xsl:apply-templates>
  </xsl:template>

Hope this helps you.

Regards,
Américo Albuquerque 



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.