This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Merging Two DTDs for XSLT - Can anyone help?


Sorry, this reply is also off topic...

There is a syntax for what you're asking, but I don't think it 
will do what you want. I may be misunderstanding, but it sounds
like you want to take an entire XML document, lets say it's a.xml
and the document element is named a-wrapper, and insert it somewhere
inside b.xml. 

To do this, validly, the element a-wrapper must be defined as content
inside at least one element from the DTD for b.xml. To do this, 
you __have__ to not just insert the DTD for a.xml into the DTD for
b.xml, but you __have__ to change the content model of the element in
b.xml where you want to insert the a.xml document. 

In other words, it's not just a question of inserting the definitions
from the DTD for a.xml into the DTD for b.xml -- you have to change
some of the content of the DTD for b.xml in order for it to work 
in a valid way. 

First question, does it have to be valid? XML can be well-formed
and have a DTD which would get around your entire problem.

If that doesn't work, there here is what you need: 

1. First, you make sure that there are no elements or parameter 
entities in the DTD for a.xml that have the same names as elements 
or parameter entities in b.xml. If there are, the problem is complicated 
and I can't explain it in an email. You would have to resolve these
duplicates names, and namespaces is probably the best way to do that.

2. Let's say that you want to insert a.xml inside b.xml directly
after the document element b-wrapper. So the final output would look
something like this: 

<b-wrapper>
<a-wrapper>...rest of contents of a.xml </a-wrapper>
...rest of contents of b.xml...
</b-wrapper>

To make this valid, you must find the element declaration for b-wrapper
in the b DTD and change it like this: 

<!ELEMENT b-wrapper  (a-wrapper?, ...rest of the existing content model ...)
>

The ? allows a b-wrapper document to omit a-wrapper, but also allows
it to have it. 

3. Then, you define an entity for the DTD for a.xml like this:

<!ENTITY % a-include SYSTEM "put the path to the DTD for a.xml here">

replacing what's inbetween " and " with the correct path to the DTD for
a.xml.

4. Right after that new entity declaration, you refer to the entity 
which includes it in the DTD for b.xml:

&a-include;

This literally includes the entire DTD for a.xml in the DTD for b.xml.

Sara

> -----Original Message-----
> From: Bassi Suk [mailto:bassi.s@mellon.com]
> Sent: Wednesday, November 22, 2000 1:45 AM
> To: 'xsl-list@mulberrytech.com'
> Subject: RE: Merging Two DTDs for XSLT - Can anyone help?
> 
> 
> 
> > I know that this is not a traditional XSLT problem, but 
> this has an impact
> > on my XSLT transformation of a XML document.
> > 
> > I have an XML document of one DTD which needs to be 
> transformed into a XML
> > document with another DTD.
> > 
> > However, l need to copy the original XML document into the 
> target XML
> > document, but the target DTD will not allow this to happen.
> > 
> > What is the syntax for embedding another DTD within a DTD via a file
> > reference?
> > 
> > Therefore, l could change the embedded DTD without changing 
> the structure
> > of the "true" target DTD.
> > 
> > I want to do the following:
> > 
> > <!ELEMENT ......>
> > 
> > .....
> > 
> > {link in DTD of another document] as though it is one whole 
> document.}
> > 
> > .....
> > 
> > <!ELEMENT ........>
> > 
> > Any help would be gratefully appreciated.
> > 
> > Suk.
> *****************************************************************
> DISCLAIMER:   The information contained in this e-mail may be 
> confidential
> and is intended solely for the use of the named addressee.  
> Access, copying
> or re-use of the e-mail or any information contained therein 
> by any other
> person is not authorized.  If you are not the intended 
> recipient please
> notify us immediately by returning e-mail to the originator.    
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]