Altova Mailing List Archives


RE: [xsl] Loss of white space

From: Wendell Piez <wapiez@---------------->
To:
Date: 9/8/2003 10:08:00 AM
Arthur,



If you tell us which FO formatter you're using, someone might be able to 
suggest whether/if there's a wrinkle that bears on your requirement to 
preserve white space....



Cheers,
Wendell

At 04:55 AM 9/8/2003, you wrote:
Hello xsl-list,



  Thank you WP, VC and DP for the correspondence



  WP I did try white-space="pre"  linefeed-treatment="preserve"    no 
joy, will

  be researching http://www.zvon.org

  DP (At the learning stage I did buy a copy of your book, and useful it 
was to.)



 AS REQUESTED MORE DETAIL



  I am reverse engineering SQL Server 2000 databases
  This bit deals with captured Stored Procedures

  BELOW 1 Is how a captured stored procedure appears in the xml document

          (viewed in XMLSpy">XMLSpy ).

          Note: The code for the stored procedure is put in a 
CDATA     <code>code<![CDATA[ ...]]></code>



  BELOW 2 Is how it is rendered in PDF   (using xsl:fo and apache fop)



  This is the template used:  4th line up from bottom

                              <fo:block ><xsl:value-of 
select="./code"/></fo:block>



<xsl:template match="stored-proc" mode="proc">
      <!-- List of stored procedures in database. -->
     <fo:page-sequence master-reference="odd">

             <fo:static-content flow-name="odd-before">

               <fo:block xsl:use-attribute-sets="a-running"><xsl:value-of 
select="//@project-name"/></fo:block>

               <fo:block xsl:use-attribute-sets="b-running"><xsl:value-of 
select="//@rdbms-name"/><xsl:text> version </xsl:text><xsl:value-of 
select="//@rdbms-version"/></fo:block>

            </fo:static-content>



            <!--date and page number footer -->
            <fo:static-content flow-name="odd-after">
               <fo:block xsl:use-attribute-sets="a-running" >
                  <fo:inline><xsl:value-of select="@date-asat" />
                     <fo:leader leader-pattern="space" leader-length="30%" />
                        <xsl:text>Page - </xsl:text><fo:page-number/>
                     <fo:leader leader-pattern="space" leader-length="30%" />
                  </fo:inline >
               </fo:block>
            </fo:static-content>


        <fo:flow flow-name="odd-body">



        <fo:block xsl:use-attribute-sets="c-head">

           <xsl:text>Source code for: </xsl:text><xsl:value-of 
select="./sp-name"/>

        </fo:block>

        <fo:block ><xsl:value-of select="./code"/></fo:block>

      </fo:flow>

   </fo:page-sequence>

</xsl:template>




---- BELOW 1 ---- Captured Stored Procedure -------



   <stored-proc date-created="2003-09-05T13:08:37" sp-owner="dbo">

      <sp-name>uspConstantBuildTaxa</sp-name>

      <code>code<![CDATA[

CREATE        Procedure uspConstantBuildTaxa (

   @constantid int

)

AS

SET NOCOUNT ON

DECLARE @Level int

Create TABLE #stack (

   constantid int,

   [Level] int

)

SELECT @Level=1

INSERT INTO #stack SELECT constantid, 1 FROM Constant WHERE 
constantid=@constantid

WHILE @Level >  0 BEGIN

   if EXISTS (SELECT * FROM #stack WHERE [Level] = @Level)     BEGIN

      SELECT TOP 1 @constantid=constantid FROM #stack WHERE 
[Level]=@Level ORDER BY constantid

      DELETE FROM ConstantTaxa WHERE constantid=@constantid



        INSERT INTO ConstantTaxa

            SELECT C.constantid,

                          IsNull(P.[Level],0)+1,

                          IsNull(P.Taxa,'.' )+CAST(C.constantid AS 
nvarchar(15))+'.'

            FROM Constant AS C LEFT OUTER JOIN ConstantTaxa AS P

            ON C.TaxonID=P.constantid

            WHERE @constantid=C.constantid

      DELETE FROM #stack WHERE constantid=@constantid

      INSERT #stack

         SELECT constantid, @LEVEL+1 FROM Constant

         WHERE TaxonID=@constantid

   If @@ROWCount > 0

      SELECT @Level=@Level+1

   END ELSE

      SELECT @Level=@Level-1

END

SET NoCount OFF



GO
]]></code>
   </stored-proc>


---- BELOW 2 ---- Stored Procedure rendered in PDF -------



Source code for: uspConstantBuildTaxa

code CREATE Procedure uspConstantBuildTaxa ( @constantid int ) AS SET 
NOCOUNT ON

DECLARE @Level int Create TABLE #stack ( constantid int, [Level] int ) 
SELECT @Level=1

INSERT INTO #stack SELECT constantid, 1 FROM Constant WHERE 
constantid=@constantid

WHILE @Level > 0 BEGIN if EXISTS (SELECT * FROM #stack WHERE [Level] = 
@Level) BEGIN

SELECT TOP 1 @constantid=constantid FROM #stack WHERE [Level]=@Level ORDER BY

constantid DELETE FROM ConstantTaxa WHERE constantid=@constantid INSERT INTO

ConstantTaxa SELECT C.constantid, IsNull(P.[Level],0)+1, IsNull(P.Taxa,'.' 
)+CAST(C.constantid

AS nvarchar(15))+'.' FROM Constant AS C LEFT OUTER JOIN ConstantTaxa AS P ON

C.TaxonID=P.constantid WHERE @constantid=C.constantid DELETE FROM #stack WHERE

constantid=@constantid INSERT #stack SELECT constantid, @LEVEL+1 FROM Constant

WHERE TaxonID=@constantid If @@ROWCount > 0 SELECT @Level=@Level+1 END ELSE

SELECT @Level=@Level-1 END SET NoCount OFF GO




--
Best regards,
 Arthur                          mailto:ArthurMaloney@xxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.