xsl-list
[Top] [All Lists]

[xsl] Modifying a DTD with XSLT

2010-10-04 05:08:50
Hello,

My original task is to split a source XML file into certain chunks to make 
handling with translation systems easier (if you want to have several 
translators work in parallel some systems apparently cannot split received data 
into chunks on their own). Since the source document contains cross-references 
with idref/id attributes throughout the content I cannot use the original DTD 
which specifies attributes like

<!ATTLIST crossref   idref     IDREF     #IMPLIED>
<!ATTLIST section    id        ID        #IMPLIED>

because @idref and @id might end up in different chunks. The XML parser would 
then complain.

I could create XML chunks without any DTD reference, but this would not allow 
validation of the structure after translation. So I  thought of creating a 
slightly modified version of the DTD with

<!ATTLIST crossref   idref     CDATA     #IMPLIED>

Since the original DTD is likely to change at other places, I plan to make that 
change on-the-fly with the splitting of the source XML.

Long story short: Can you think of another way to make such a change than with 
a combination of 
<xsl:result-document method="text">, 
unparsed-text($dtdpath), and
replace($dtdstring, 'idref\s+IDREF', 'idref CDATA') 

Thanks a lot for your comments,

- Michael Müller-Hillebrand

PS: I can see that XSL could be used more elegantly with an XML Schema, but 
this is no option currently.



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>