Generalize Transform

Post here questions and problems related to editing and publishing DITA content.
DitaConversion
Posts: 4
Joined: Thu Aug 25, 2016 5:31 pm

Generalize Transform

Post by DitaConversion »

Hello,

With the previous help from the forums I was able to proceed further in my attempt to "de-specialize" my .dita file.

I used an XSLT transform using the generalize.xsl file in the DITA OT, which works great. However I have a slight modification I would like to perform, and was wondering if anyone knew how to make this change in the transform process.

Currently the tag is setup as follows:

Code: Select all


<step class "- topic/li task/step " id="4552654-154225">inner text</step>
When i perform the transformation, I get:

Code: Select all


<li class= "- topic/li task/step " id="4552654-154225">inner text</li>
Is there a way to modify it so I can choose which attributes remain? i.e if I just wanted the output to be as shown below so that it contains no trace of the specialization:

Code: Select all


<li class= "- topic/li " id="4552654-154225">inner text</li>
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: Generalize Transform

Post by Radu »

Hi,

You probably do not need the @class attributes at all, as the DTDs already define default values for them.
So if in the "generalize.xsl" you find the XSLT template:

Code: Select all


<xsl:template match="*[@class]">
..................
</xsl:template>
at some point it copies all attributes:

Code: Select all

<xsl:copy-of select="@*"/>
and you can instruct it to copy all attributes except @class:

Code: Select all


<xsl:copy-of select="@*[not(name()='class')]"/>
There are various online resources for learning XSLT which should be a valuable tool when working with DITA.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply