RE: [xsl] XSL Dependency Mapping

Subject: RE: [xsl] XSL Dependency Mapping
From: David.Pawson@xxxxxxxxxxx
Date: Fri, 25 Jul 2003 13:49:49 +0100
Below, an attempt at mapping from a stylesheet to 
.dot file.

The conversion to .svg is

dot -TSVG xxx.dot xxx.svg

I think its possible to control it further,
but when I mapped the docbook includes,
the svg was about 15 inches wide ...... :-)

regards DaveP



<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.1">
 <xsl:param name="root" select="'root'"/>
<d:doc xmlns:d="rnib.org.uk/tbs#">
 <revhistory>
   <purpose><para>This stylesheet works with *.xsl to produce *.dot for
graphviz processing</para></purpose>
   <revision>
    <revnumber>1.0</revnumber>
    <date> 2003</date>
    <authorinitials>DaveP</authorinitials>
    <revdescription>
     <para></para>
    </revdescription>
    <revremark></revremark>
   </revision>
  </revhistory>
  </d:doc>
  

  <xsl:output method="text"/>



  <xsl:template match="xsl:stylesheet">
    digraph G{
  

    <xsl:if test="not(*[self::xsl:include or self::xsl:import])">
      NoImportsOrIncludes;
    </xsl:if>
    <xsl:apply-templates select="*[self::xsl:include or self::xsl:import]">
      <xsl:with-param name='src' select="translate($root,'.','_')"/>
    </xsl:apply-templates>
    <xsl:text>&#10;}</xsl:text>
  </xsl:template>




  <xsl:template match="xsl:include">
    <xsl:param name="src" select="'none'"/>
    <xsl:message>
include      <xsl:value-of select="@href"/>
    </xsl:message>
    <xsl:value-of select="concat('&#10;',$src,' -> ')"/>

    <xsl:value-of select="concat('&quot;',@href,'&quot;')"/>
[label="(include)"]; &#10;<xsl:text> </xsl:text>
    <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="' '"/>
        </xsl:otherwise>
      </xsl:choose>

      <xsl:apply-templates
        select="document(@href)/xsl:stylesheet/*[self::xsl:include or
                self::xsl:import]"/>

  </xsl:template>

  <xsl:template match="xsl:import">
    <xsl:value-of select="substring-before(@href,'.')"/> [label="(import)"]


      <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="';'"/>
        </xsl:otherwise>
      </xsl:choose>

    <xsl:apply-templates
      select="document(@href)/xsl:stylesheet/*[self::xsl:include or
              self::xsl:import]"/>
  </xsl:template>



  <xsl:template match="*">
    *****<xsl:value-of select="name(..)"/>/<xsl:value-of
select="name()"/>******
</xsl:template>


</xsl:stylesheet>

- 

NOTICE: The information contained in this email and any attachments is 
confidential and may be legally privileged. If you are not the 
intended recipient you are hereby notified that you must not use, 
disclose, distribute, copy, print or rely on this email's content. If 
you are not the intended recipient, please notify the sender 
immediately and then delete the email and any attachments from your 
system.

RNIB has made strenuous efforts to ensure that emails and any 
attachments generated by its staff are free from viruses. However, it 
cannot accept any responsibility for any viruses which are 
transmitted. We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email 
and any attachments are those of the author and do not necessarily 
represent those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk 

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


Current Thread