Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - RE: xslt hard CR [Thread Next] Re: xslt hard CRTo: NULL Date: 1/4/2005 11:17:00 PM This document probably describes in detail the way you might want to do this http://www.azureus.com/xml/art_prettyprinting_xml.htm But basically, inserting into the template <xsl:text> </xsl:text> for return and <xsl:text> </xsl:text> for newline should get you there. Cheers - Neil On Tue, 4 Jan 2005 06:53:07 -0800, "mike w." <mikew@d...> wrote: >no, i nedd to insert a hard CR not preserve an existing one > >"MAHESH MANDHARE" wrote: > >> hi mike >> >> i don't get your question completely >> but what i understood from your post is that you want to interprete newline >> in xml >> if you r not talking about html >> then when you transform the file in xml the newline &spaces are preserved in >> resulting xml >> only you have to use <xml:output method="xml"/> at top level >> >> what i have tried it on my own files see only <descr> element >> >> >> ////////xml file >> >> >> >> <?xml version="1.0"?> >> <?xml-stylesheet type="text/xsl" href="E:\Users\MaheshM\msdn >> newsgroup\work.xsl"?> >> <statement> >> <detail> >> <number>4</number> >> <entryDate>2004-12-07</entryDate> >> <type>charge</type> >> <descr>Business DSL 768/128</descr> >> <chargeType>Misc</chargeType> >> <charge>43.11</charge> >> <tax>0.00</tax> >> <total>43.11</total> >> <quantity>1.00</quantity> >> <unitPrice>43.11</unitPrice> >> <startDate>2004-12-07</startDate> >> <endDate>2005-01-02</endDate> >> <PONumber/> >> </detail> >> <detail> >> <number>6</number> >> <entryDate>2004-12-07</entryDate> >> <type>charge</type> >> <descr>E-mail: >> mahjo jfew</descr> >> <serviceName>bkeefer</serviceName> >> <charge>1.74</charge> >> <tax>0.00</tax> >> <total>1.74</total> >> <quantity>1.00</quantity> >> <unitPrice>1.74</unitPrice> >> <startDate>2004-12-07</startDate> >> <endDate>2005-01-02</endDate> >> <PONumber/> >> </detail> >> <detail> >> <number>7</number> >> <entryDate>2004-12-07</entryDate> >> <type>charge</type> >> <descr>E-mail</descr> >> <serviceName>csmith</serviceName> >> <charge>1.74</charge> >> <tax>0.00</tax> >> <total>2.74</total> >> <quantity>1.00</quantity> >> <unitPrice>1.74</unitPrice> >> <startDate>2004-12-07</startDate> >> <endDate>2005-01-02</endDate> >> <PONumber/> >> </detail> >> <detail> >> <number>2</number> >> <entryDate>2004-12-07</entryDate> >> <type>charge</type> >> <descr>E-mail</descr> >> <serviceName>bbarker</serviceName> >> <charge>1.74</charge> >> <tax>0.00</tax> >> <total>1.74</total> >> <quantity>1.00</quantity> >> <unitPrice>1.74</unitPrice> >> <startDate>2004-12-07</startDate> >> <endDate>2005-01-02</endDate> >> <PONumber/> >> </detail> >> </statement> >> >> >> ///////xslt file >> >> <xsl:template match="statement" xml:space="preserve" priority="3"> >> >> >> <xsl:text disable-output-escaping="yes" >this is > > > >> Áa table <></xsl:text> >> >> <TABLE BORDER="1" CELLSPACING="0" CELLPADDING="5" WIDTH="100%"> >> <TR> >> <TD WIDTH="10"><B>num</B></TD> >> <TD WIDTH="10"><B>Qty</B></TD> >> <TD WIDTH="300"><B>Description</B></TD> >> <TD WIDTH="20"><B>Unit Price</B></TD> >> <TD WIDTH="20"><B>Ext. Price</B></TD> >> <TD WIDTH="20"><B>Tax</B></TD> >> <TD WIDTH="20"><B>Total</B></TD> >> </TR> >> <xsl:value-of select="descr" ></xsl:value-of> >> >> >> <xsl:for-each select="detail" xml:space="default"> >> >> <TR> >> <td><xsl:number format="=>.a" letter-value="traditional" >> grouping-separator="," value="position()"></xsl:number></td> >> <TD width="10"><xsl:value-of select="quantity" /></TD> >> <TD width="550"><xsl:value-of select="descr" ></xsl:value-of></TD> >> <TD width="20"><xsl:value-of select="unitPrice"/></TD> >> <TD width="20"><xsl:value-of select="tax"/></TD> >> <TD width="20"><xsl:value-of select="total"/></TD> >> >> </TR> >> >> >> >> </xsl:for-each> >> </TABLE> >> >> </xsl:template> >> >> >> >> >> </xsl:stylesheet> >> >> >> >> >> >> ////and the resulting xml >> >> <?xml version="1.0" encoding="UTF-8"?> >> <?xml-stylesheet version="1.0" href="work_practice.xsl"?><HTML>this is >> >> >> >> a table <><TABLE BORDER="1" CELLSPACING="0" CELLPADDING="5" >> WIDTH="100%"><TR><TD WIDTH="10"><B>num</B></TD><TD >> WIDTH="10"><B>Qty</B></TD><TD WIDTH="300"><B>Description</B></TD><TD >> WIDTH="20"><B>Unit Price</B></TD><TD WIDTH="20"><B>Ext. Price</B></TD><TD >> WIDTH="20"><B>Tax</B></TD><TD >> WIDTH="20"><B>Total</B></TD></TR><TR><td>=>.a</td><TD width="10">1.00</TD><TD >> width="550">Business DSL 768/128</TD><TD width="20">43.11</TD><TD >> width="20">0.00</TD><TD width="20">43.11</TD></TR><TR><td>=>.b</td><TD >> width="10">1.00</TD><TD width="550">E-mail: >> mahjo jfew</TD><TD >> width="20">1.74</TD><TD width="20">0.00</TD><TD >> width="20">1.74</TD></TR><TR><td>=>.c</td><TD width="10">1.00</TD><TD >> width="550">E-mail</TD><TD width="20">1.74</TD><TD width="20">0.00</TD><TD >> width="20">2.74</TD></TR><TR><td>=>.d</td><TD width="10">1.00</TD><TD >> width="550">E-mail</TD><TD width="20">1.74</TD><TD width="20">0.00</TD><TD >> width="20">1.74</TD></TR></TABLE></HTML> | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
