Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 8th, 2006, 03:38 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 109
Thanks: 18
Thanked 0 Times in 0 Posts
Default Can I 'apply-templates' across multiple XML docume

A simple version of what I have it this:

Code:
<xsl:variable name="generic-common-xsd" select="document('../XSD/Common/NMIE-Generic-Common.xsd')"></xsl:variable>

<!-- Do some processing in the root XML document, then at some point
I need to process something in the other XML document -->
<xsl:element name="Value">
      <xsl:apply-templates select="$generic-common-xsd/xs:simpleType[@name='$TypeVal']" mode="Type"></xsl:apply-templates>
</xsl:element>


<xsl:template match="xs:simpleType" mode="Type">
   <xsl:element name="Domain"></xsl:element>
</xsl:template>
Basically, for ease of re-use, I have separated my schemas across multiple files.

What I have above is not working.
Is this even possible?

------------------------
GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF&nbsp;&nbsp;ACE5 CA93 7AD5 D8E3 A876

Michael Hare
__________________
------------------------
Keep Moving Forward

GnuPG Key fingerprint = 1AD4 726D E359 A31D 05BF ACE5 CA93 7AD5 D8E3 A876

Michael Hare
 
Old June 8th, 2006, 05:12 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The document() function returns a document node. In the case of a schema, one would expect the only child of that document node to be an xs:schema element. To select an xs:simpleType element, I would expect to see document(...)/xs:schema/xs:simpleType.

I would also expect to see the predicate [@name=$TypeVal] rather than [@name='$TypeVal']

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Exclude Elements in Apply Templates mail4kaja XSLT 18 November 29th, 2008 12:09 PM
Apply-templates combined with with-param ? Smirre XSLT 6 November 11th, 2008 08:25 AM
apply-templates problem within for-each loop mister_mister XSLT 2 January 22nd, 2007 05:40 PM
Templates Won't Apply neilac333 XSLT 5 October 26th, 2006 01:39 PM
xsl:apply-templates on Variable containing xml nexus5 XSLT 9 November 4th, 2004 02:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.