Hi again,

What do you think about using a xml cache file like below (xml instance followed by XML schema). Since the same XSL (xsl:include/ xsl:import) and XML (from the doc/document function) files can be used in several different, it would make sense to allow the cache file to be reused in multiple xslt tasks.

Using an XML doc with IDs and IDREF can reduce the redundancy of the same file(s) being reused in multiple and/or different transformations. (and speed up finding the appropriate reference)

perhaps this is how the xslt task is extended in a build file like so:

<xslt modifiedCache="xsl-cache.xml"...

The existence of this attribute (whatever it is named :) ) indicates the use of the caching/spying trax liason ?

Here is an example instance of a reusable cache doc followed by an XML schema:

<?xml version="1.0" encoding="UTF-8"?>
<cache>

  <xsl source="path/to/source1.xsl">
    <templates>
      <depends idref="path/to/xsl/import1.xsl"/>
      <depends idref="path/to/xsl/include1.xsl"/>
    </templates>
    <transformer source="path/to/xml/sourceA.xml">
      <depends idref="path/to/xml/source1.xml"/>
      <depends idref="path/to/xml/source2.xml"/>
      <depends idref="path/to/xml/source3.xml"/>
    </transformer>
    <transformer source="path/to/xml/sourceB.xml">
      <depends idref="path/to/xml/source1.xml"/>
      <depends idref="path/to/xml/source2.xml"/>
      <depends idref="path/to/xml/source3.xml"/>
    </transformer>
  </xsl>

  <xsl source="path/to/source2.xsl">
    <templates>
      <depends idref="path/to/xsl/import1.xsl"/>
      <depends idref="path/to/xsl/include1.xsl"/>
    </templates>
    <transformer source="path/to/xml/sourceA.xml">
      <depends idref="path/to/xml/source2.xml"/>
      <depends idref="path/to/xml/source3.xml"/>
      <depends idref="path/to/xml/source4.xml"/>
    </transformer>
    <transformer source="path/to/xml/sourceB.xml">
      <depends idref="path/to/xml/source2.xml"/>
      <depends idref="path/to/xml/source3.xml"/>
      <depends idref="path/to/xml/source4.xml"/>
    </transformer>
  </xsl>

  <dependencies>
    <dependency id="path/to/xsl/import1.xsl">78f43t84t</dependency>
    <dependency id="path/to/xsl/include1.xsl">y8734qr</dependency>
    <dependency id="path/to/xml/source1.xml">437hr88qr3</dependency>
    <dependency id="path/to/xml/source2.xml">c7834fr4g</dependency>
    <dependency id="path/to/xml/source3.xml">hq378d43</dependency>
    <dependency id="path/to/xml/source4.xml">dh78234</dependency>
  </dependencies>

</cache>


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified">
  <xs:element name="cache">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="xsl">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="templates">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" ref="depends"/>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="transformer" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" ref="depends"/>
                  </xs:sequence>
<xs:attribute name="source" use="required" type="xs:anyURI"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
<xs:attribute name="source" use="required" type="xs:anyURI"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="dependencies">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="dependency">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
<xs:attribute name="id" use="required" type="xs:anyURI"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
    <xs:key name="dependency-key">
      <xs:selector xpath="dependencies/dependency"/>
      <xs:field xpath="@id"/>
    </xs:key>
    <xs:keyref name="dependency-idrefs" refer="dependency-key">
      <xs:selector xpath=".//depends"/>
      <xs:field xpath="@idref"/>
    </xs:keyref>
  </xs:element>
  <xs:element name="depends">
    <xs:complexType>
      <xs:attribute name="idref" use="required" type="xs:anyURI"/>
    </xs:complexType>
  </xs:element>
</xs:schema>


On Oct 27, 2008, at 4:37 PM, Dominique Devienne wrote:

On Mon, Oct 27, 2008 at 11:51 AM, Robert Koberg <[EMAIL PROTECTED]> wrote:
I would love to use a properties implementation that  [...]

Is something like this available now in Ant?

Maybe not exactly what you want, but have a look at PropertySet (and
<propertyset>).

If not, would the commons configuration be OK as a dependency?

That's an easy *NO* ;-)

Ant is used to build Commons, so that would be a circular dependency.
Ant lives at the very bottom of the dependency stack in Gump, so can't
depend on anything else. The few exceptions are checked in JARs for
the XML parser in lib/ (and JUnit in lib/optional/, because unit
testing is so integral to Ant).

* new class name TraxCachingLiason -- ideas?

CachingTraxLiaison - but then again, all badly chosen names in Ant are
mine (TM) ;-)

I used that name so it would show up next to TraxLiaison in the javadoc :)

I'm afraid this is a tough name to come up with. Caching doesn't
convey the right idea here IMHO. Sure, the impl uses caching of the
dependencies, but that's an implementation detail. You're adding
additional "Smart's" to <xslt>, to avoid unnecessary transforms, by
"spying" on URI resolving. So maybe a SpyResolverTraxLiaison? ;)  I
don't have a better suggestion... --DD

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to