473,390 Members | 1,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

XSLT failing to load include tag in XSD schema file

392 Expert 256MB
I am trying to run an XSLT on a schema (XSD) file. The schema file has a "xsd:include" 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 4096
jkmyoung
2,057 Expert 2GB
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 Expert 256MB
Removed post after re-reading the above response.
Mar 24 '08 #3
pronerd
392 Expert 256MB
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 Expert 2GB
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 Expert 256MB
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
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"...
1
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...
1
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...
0
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...
1
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....
3
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...
0
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>...
3
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.