Xalan 1.5
Xerces 2.2.0
WinXP
VC6 sp5

I am converting our code from Java Xalan to C++ Xalan.
One of the things we use on every page is:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  <xsl:template match="/">
    <xsl:value-of select="data"/>
  </xsl:template>
  <xsl:include href="/xsl?name=genericHead.xsl"/>
</xsl:stylesheet>

Specifically:
  <xsl:include href="/xsl?name=genericHead.xsl"/>

For Java Xalan, I had to create a XSLTURIResolver.java.
When a xsl:include is found, the resolver tells xalan how to find the
genericHead.xsl document.

Is this supported in the C++ Xalan?  
I have looked around the C++ API docs, but it is quite different than
the Java version.

Is there a sample that does this?
I grepped through the sample directory for this, but couldn't find
anything.

When I tried it:

XalanTransform.exe generic.xml generic.xsl

XSLT warning: Fatal Error at (file <unknown>, line 0, column 0): An
exception oc
curred! Type:RuntimeException, Message:The primary document entity could
not be
opened.
Id=file:///C:/OpenSrc/xalan/C/xml-xalan/c/samples/XalanTransform//xsl?na
me=genericHead.xsl (generic.xsl, line 7, column 50)
Error: SAXParseException: An exception occurred! Type:RuntimeException,
Message:
The primary document entity could not be opened.
Id=file:///C:/OpenSrc/xalan/C/x
ml-xalan/c/samples/XalanTransform//xsl?name=genericHead.xsl (, line 0,
column 0)

  <xsl:include href="/xsl?name=genericHead.xsl"/>

It could be the format of the include, in this case it had to go to
http://localhost/xsl to retrieve the XSL.

TIA,
Dave


Here were the 2 files I used:
generic.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  <xsl:template match="/">
    <xsl:value-of select="data"/>
  </xsl:template>
  <xsl:include href="/xsl?name=genericHead.xsl"/>
</xsl:stylesheet>

generic.xml
<?xml version="1.0" encoding="UTF-8"?>
<data>This is a test!</data>


Reply via email to