473,795 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT failing to load include tag in XSD schema file

392 Recognized Expert Contributor
I am trying to run an XSLT on a schema (XSD) file. The schema file has a "xsd:includ e" tag that includes another XSD file. When I load the schema in XML editors like XML Spy the data from all of the files is loaded. When I run the XSL translation only the XSD data from the first file is loaded and translated. The data from the file referenced in the included tag is skipped.

Anyone have any ideas why?

Example XSD file
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8" standalone="yes"?>
  2. <xsd:schema targetNamespace="http://ACORD.org/Standards/Life/2" xmlns="http://ACORD.org/Standards/Life/2" elementFormDefault="unqualified" attributeFormDefault="unqualified" version="2.18.00" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  3.     <xsd:include schemaLocation="XMLife2.18.00.xsd" />
  4.     <xsd:element name="ChangeSubType" type="ChangeSubType_Type" />
  5. .....
  6. .....
  7. .....
  8. </xsd:schema>
  9.  
Mar 21 '08 #1
5 4111
jkmyoung
2,057 Recognized Expert Top Contributor
The XSLT engine treats the file purely as XML, ignoring the other meaning behind include.
I would suggest including a template like so:

Expand|Select|Wrap|Line Numbers
  1. <xsl:template match="xsd:include">
  2.   <xsl:apply-templates select="document(@schemaLocation)"/>
  3. </xsl:template>
  4.  
Mar 24 '08 #2
pronerd
392 Recognized Expert Contributor
Removed post after re-reading the above response.
Mar 24 '08 #3
pronerd
392 Recognized Expert Contributor
Im afraid that does not work. That runs the XSLT on the three files independently. It needs to load and process them all as one file. The same way it would if you where loading the XSD to validate XML data.

I have tried it in JDeveloper and XML Spy with the same problem. I also tried removing the XSL prefix. I can not seem to find a way to get it to process the include tag.
Mar 25 '08 #4
jkmyoung
2,057 Recognized Expert Top Contributor
Is it possible to create a giant merged xsd through one pass, and then run a xslt on the result?

Another option might be to create a global reference variable, with all 3 files in it. eg
Expand|Select|Wrap|Line Numbers
  1. <xsl:variable name="master">
  2.   <xsl:apply-templates select="/" mode="copy"/>
  3. </xsl:variable>
  4. <xsl:template match="xsd:include" mode="copy">
  5.   <xsl:apply-templates select="document(@schemaLocation)/xsd:schema/*"/>
  6. </xsl:template>
  7. <xsl:template match="*" mode="copy">
  8.   <xsl:copy>
  9.     <xsl:copy-of select="@*"/>
  10.     <xsl:apply-templates/>
  11.   </xsl:copy>
  12. </xsl:template>
  13. --
  14. rest of xsl...
  15.  
Mar 25 '08 #5
pronerd
392 Recognized Expert Contributor
Is it possible to create a giant merged xsd through one pass, and then run a xslt on the result?
Sorry, that I did not follow up with the solution. That is exactly what I ended up doing.
Apr 1 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

20
6799
by: Bernd Fuhrmann | last post by:
Hi! I have some trouble with some simple stupid XSLT-stuff. My stylesheet: ------------- <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1
1872
by: Duane Morin | last post by:
I fear this might be a FAQ but I can't figure out how to google for it. Recently we had a big bug where the source that an XSL file acted on changed out from under it. Result, the XSL matched nothing and important content did not make it to the final destination. I was under the impression that an XSL could be told "You will be acting on an XML that is valid according to the following DTD." Thus, if the XML that it was applied...
1
1681
by: Harry Zoroc | last post by:
I would like to treat an xsd Schema file as XML file and to display the targetNamespace and all the imports. That's it. But the following does not work. Why? I did not enter the stylesheet in the xsd file directly but tried to compute the output on the command line e.g. with xalan like: java net.sf.saxon.Transform -o myout.html myschema.xsd myxsltfile.xslt Using Saxon yields no better result. The produced myout.html contains all HTML...
0
1399
by: Andy Dingley | last post by:
I'm writing XSLT to transform fntg-schema (our own project's document schema) into PartnerML, a HTML-like XML dialect used for mobile phones. I'm using XMLSPy 4.4 to do this. The schema for PartnerML is supplied in several modules, brought together by <xs:include> and <xs:import> statements. My understanding (and experiment) suggests that XMLSpy can't work with such a modularized schema. As a result, my XSLT documents have a header...
1
363
by: Wil | last post by:
I'm very new to developing in .NET and even newer to XML. The past few days have been pretty frustrating for me because I'm trying to perform a transform on data in a dataset and it's not working. Basically, all of the data is stored in an Access .mdb that is read into a dataset when the application is loaded. There are some minor changes to the schema between what is in the physical database to accomodate some things that Access just...
3
2197
by: Teksure | last post by:
Hi group, searching in the Internet I found two products for XML which incorporate a very robust debugger for XSL/XSLT, I would like you to see these products and then, give me your opinion about the development environment or recommend me some other that you know. XML IDE's - http://xslt-process.sourceforge.net - http://www.mentattech.com/themes/mentat/alchemist/index.html Regards,
0
1269
by: Terry Brown | last post by:
I have an xml file: <?xml version="1.0" encoding="utf-8" ?> <G2Registers xmlns="http://tempuri.org/registers.xsd"> <register> <name>Version Register</name> <address>"00000000"</address> <verilogname>"PPC_Version"</verilogname> <bitfield>
3
302
by: Peter Row | last post by:
Hi, I have 2 XML files and 1 XSLT file. The second XML file has the following declarative 1st line: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> ....the 1st one (the one to be transformed) doesn't. In the transform file I load the 2nd XML file which contains
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10002
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.