xsl-list
[Top] [All Lists]

Re: [xsl] Rebuild an element without copying defaulted attributes?

2014-08-13 09:06:39
Thanks, good to know what is coming.


Sent on a Sprint Samsung Galaxy Note® II

<div>-------- Original message --------</div><div>From: "Eliot Kimber 
ekimber(_at_)contrext(_dot_)com" 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 
</div><div>Date:08/13/2014  4:15 AM  (GMT-08:00) </div><div>To: xsl-list 
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com> </div><div>Subject: Re: 
[xsl] Rebuild an element without copying defaulted attributes? </div><div>
</div>For DITA, the attributes @class and @domains would normally be omitted
from instances in all cases (assuming the documents will have DTDs or
schemas to then provide the defaults).

For DITA 1.3 we're using RELAX NG as the normative form of the DITA
vocabulary. DITA uses the RELAX NG DTD compatibility facilities to specify
attribute defaults, which makes it easy to know what the defaults are.

It should be relatively easy to implement an XSLT or XQuery to report all
the attribute defaults, which would certainly be useful for this sort of
DITA-to-DITA transform. I'll see if I can do something for this quickly
this weekend. 

The RELAX NG versions of the vocabulary can be accessed from the DITA
Technical Committee's SVN repository:

http://tools.oasis-open.org/version-control/svn/dita/doctypes/src

There are both 1.2 and 1.3 versions of the RELAX NG. In
doctypes/tools/relaxng there is some general XSLT code for working with
the RELAX NG documents.

Cheers,


Eliot
—————
Eliot Kimber, Owner
Contrext, LLC
http://contrext.com




On 8/12/14, 5:14 PM, "Abel Braaksma (Exselt) abel(_at_)exselt(_dot_)net"
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:


I'm looking for a generalized solution so I didn't have to search
the DTD for all defaulted vaules. I just happened to catch
xml:space as I had a different problem that I fixed.

Remember that in XML there is no difference between the defaulted value
of the attribute set through the DTD and the same value set explicitly.
Also, unless you copy the same DTD to the output, you would lose this
default value if you remove it as in the examples shown, which is why the
attribute with default value is considered to be present on the <pre> and
other elements on which it is defined.

Removing it the way you did, and similar for any other defaults, may
alter the way the XML is rendered or interpreted, unless you recreate the
same defaults through a DTD. If that is intentional (i.e., if you indeed
want to remove any attribute that has a default value), straight XSLT may
not be the ideal solution, because this DTD information is not annotated
/ retained on the nodes, either during processing or in the result.

For automated processing, XML with the explicit or implicit default
attribute is the same.

Cheers,

Abel Braaksma
Exselt streaming XSLT 3.0 processor
http://exselt.net





--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>