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: XSLT text output - better formatting possible?


Hi Lyn,

"Lyn K. Finman" wrote:
> 
> I'm working on a project that is attempting to incorporate XML into a
> large C++ application.  

I use XSLT to make Java code from XML. Not sure if this is what you
want, but you could declare some entities to produce intended output:

<!DOCTYPE xsl:stylesheet [
<!ENTITY tab "<xsl:text>    </xsl:text>"> <!-- Tab -->
<!ENTITY tab2 "<xsl:text>        </xsl:text>"> <!-- Two Tabs -->
<!ENTITY tab3 "<xsl:text>            </xsl:text>"> <!-- Three Tabs -->
<!ENTITY tab4 "<xsl:text>                </xsl:text>"> <!-- Four Tabs
-->
<!ENTITY n "<xsl:text>
</xsl:text>"> <!-- New Line -->
<!ENTITY n2 "<xsl:text>

</xsl:text>"> <!-- Two new Lines -->
<!ENTITY n3 "<xsl:text>


</xsl:text>"> <!-- Three new Lines -->
<!ENTITY space "<xsl:text> </xsl:text>"> <!-- Space -->
<!ENTITY e "<xsl:text/>"> 
]>

So you can write something like

    &n;&tab;public static void main (String args[])&n;
    &tab;{&n;
    &tab2;// test&n;
    &tab;}&n2;

in your stylesheet. Of course piping the output throug a formatter would
also do the job, but I prefer to get a formatted output directly.

Have fun,

Juergen

-- 


Jürgen Baier

Propack Data GmbH
Vincenz-Prießnitz-Str. 1
D-76131 Karlsruhe / Germany

Fon. +49 (721) 9650 6
Fax. +49 (721) 9650 888

info: http://www.propack-data.de


 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]