You can use an external processed shared object to declare an object reference for fragment B, and then use it n times inside fragment A.
When fragment A is analyzed, entity references will be expanded, and the content from fragment B will be included in every place where the object was used.
For example, suppose you have a snipppetB.xml file:
<snippetB> <foo>Content goes here</foo> </snippetB>
And the file for fragment A declared an object called snippetB , referencing snippetB.xml, and used it four times:
<!DOCTYPE snippetA [ <!ENTITY snippetB SYSTEM "./snippetB.xml"> ]> <snippetA> <a>&snippetB;</a> <b>&snippetB;</b> <c>&snippetB;</c> <d>&snippetB;</d> </snippetA>
When parsing snippetA.xml, the XML content will look like this:
<snippetA> <a> <snippetB> <foo>Content goes here</foo> </snippetB> </a> <b> <snippetB> <foo>Content goes here</foo> </snippetB> </b> <c> <snippetB> <foo>Content goes here</foo> </snippetB> </c> <d> <snippetB> <foo>Content goes here</foo> </snippetB> </d> </snippetA>
Mads hansen
source share