> Hi all,
> I have a number of XML-documents with different names. Each of them is a
member of some XML-type, that is described by root node of a document.
> For example,
> "type1.xml":
> <?xml version="1.0"?>
> <DocumentType1>
> <node1/>
> <node1/>
> <node1/>
> ...
> </DocumentType1>
>
> "type2.xml":
> <?xml version="1.0"?>
> <DocumentType2>
> <node2/>
> <node2/>
> <node2/>
> ...
> </DocumentType2>
>
> How way can I select XSL-stylesheet for transformation depending on the
root element of XML-document requested?
>
> Thanks,
> Peter Velichko

I think, that's not possible. But you can make one stylesheet for both and
include both stylesheets:

the one stylesheet for both XMLs:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:include href="DocumentType1.xsl"/>
    <xsl:include href="DocumentType2.xsl"/>
</xsl:stylesheet>

DocumentType1.xsl:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:template match="DocumentType1">
        <!-- and so on -->
    </xsl:template>
</xsl:stylesheet>

DocumentType2.xsl:

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
    <xsl:template match="DocumentType2">
        <!-- and so on -->
    </xsl:template>
</xsl:stylesheet>



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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

Reply via email to