Hi all -

I have two questions regarding Ant, Xerces 2, and XInclude. I'm using Ant 1.6.5, and have upgraded its xercesImpl.jar and xml-apis.jar to Xerces 2.8.0.

The first question is regarding XmlValidate. My understanding is that I can turn on the XInclude feature with an <attribute> in the <xmlvalidate> task:

 <attribute name="http://apache.org/xml/features/xinclude"; value="true" />

When I try to validate, however, it fails on the <include> elements, as if XInclude were not working.

My first guess was that I wasn't turning on the feature correctly, but I noticed this in the Xerces 2 FAQ: "If the validation feature is turned on then DTD validation will be performed on each source document (to the XInclude processor) against their respective DTDs."

My Ant target for validation:

  <target
      name="validate-xerces"
      >
    <java classname="org.apache.xerces.impl.Version" />
    <xmlvalidate
        failonerror="yes"
        warn="yes"
        lenient="no">
<attribute name="http://apache.org/xml/features/xinclude"; value="true" />
      <xmlcatalog>
        <catalogpath>
          <pathelement location="../schemas/docbook-4.4/catalog.xml"/>
        </catalogpath>
      </xmlcatalog>
      <fileset
          dir="${book.dir}"
          includes="${book.file}" />
    </xmlvalidate>
  </target>

Is my task defined correctly to turn on XInclude? Is Xerces refusing to do XInclude prior to DTD validation as a normal behavior? What is the correct way for me to perform DTD validation with a document that uses XInclude? (Must my DTD explicitly accommodate XInclude?)


My second question is regarding the Xslt task. I would like to turn on the same Xerces feature for the purposes of XSLT processing (with Xalan). I'm not clear on how to do this. I tried:

  <target
      name="xslt-xerces"
      description="test XSLT with Xerces XInclude"
      >
    <java classname="org.apache.xerces.impl.Version" />
    <xslt
        in="${book.dir}/${book.file}"
        out="${temp.dir}/test-xsl-out.txt"
        style="test.xsl"
        >
      <factory>
<attribute name="http://apache.org/xml/features/xinclude"; value="true" />
      </factory>
    </xslt>
  </target>

but got:

BUILD FAILED
/workplace/sandersd/Projects/NewAWSDocTools/AWSDocTools/tools/TEMP/build.xml:89: java.lang.IllegalArgumentException: Not supported: http://apache.org/xml/features/xinclude

What is the correct way to turn on XInclude with Xerces with the Xslt task?


Thanks for any assistance you can provide! Let me know if I should post more complete examples.

-- Dan


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

Reply via email to