473,320 Members | 2,052 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,320 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 4093
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.