[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Formatting XML output

Subject: Re: Formatting XML output
From: "Rick Quatro" <frameexpert@xxxxxxxxxxxx>
Date: Fri, 13 Jan 2006 12:28:04 -0500
msxml formatting
Thanks for the help, but it still doesn't work. I am using a scripting language for FrameMaker called FrameScript, which allows me to access MSXML objects. Here is my basic script.

// Create the MSXML objects.
Set oXmlDoc = InitializeXObject{'Msxml2.DOMDocument.4.0'};
Set oStylesheet = InitializeXObject{'Msxml2.DOMDocument.4.0'};
If (oXmlDoc = 0) or (oStylesheet = 0)
 LeaveSub;
EndIf

// Create the stylesheet.
Set sStylesheet = '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">';
Set sStylesheet = sStylesheet + '<xsl:output method="xml" indent="yes"/>';
Set sStylesheet = sStylesheet + '<xsl:template match="/">';
Set sStylesheet = sStylesheet + '<xsl:copy-of select="."/>';
Set sStylesheet = sStylesheet + '</xsl:template>';
Set sStylesheet = sStylesheet + '</xsl:stylesheet>';
// Load the stylesheet.
oStylesheet.loadXML{sStylesheet};


// Build up the XML document.
Set oRoot = oXmlDoc.createElement{'toc'};
oRoot.setAttribute{'title','Standard Operating Procedures Manual'};
oXmlDoc.appendChild{oRoot};
Set oFolder = oXmlDoc.createElement{'folder'};
oFolder.setAttribute{'title','0135 Technical Support'};
oFolder.setAttribute{'expanded','false'};
oRoot.appendChild{oFolder};
Set oFile = oXmlDoc.createElement{'file'};
oFile.setAttribute{'title','Response to Customer Support Telephone Calls'};
oFile.setAttribute{'refid','File01.txt'};
oFolder.appendChild{oFile};
Set oFile = oXmlDoc.createElement{'file'};
oFile.setAttribute{'title','Customer Support Call List'};
oFile.setAttribute{'refid','File02.txt'};
oFolder.appendChild{oFile};

// Transform the XML document.
Set sOutput = oXmlDoc.transformNode{oStylesheet};

// Save the XML to a file.
eStr.SaveToTextFile{sOutput,ClientDir+DIRSEP+'Output.txt'};

// Delete the objects.
Delete Object(oXmlDoc);
Delete Object(oStylesheet);

When this runs, Output.txt contains the XML declaration on a single line, but the rest of the XML is on the second line with no new-lines or indents.

<?xml version="1.0"?>
<toc title="Standard Operating Procedures Manual"><folder title="0135 Technical Support" expanded="false"><file title="Response to Customer Support Telephone Calls" refid="File01.txt" /><file title="Customer Support Call List" refid="File02.txt" /></folder></toc>


This may be an MSXML (or FrameScript) issue, but I thought I would try here first. Thanks.

Rick Quatro
Carmen Publishing
585-659-8267
www.frameexpert.com


----- Original Message ----- From: "Michael Kay" <mike@xxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Friday, January 13, 2006 10:43 AM
Subject: RE: Formatting XML output



<xsl:stylesheet...

<xsl:output indent="yes"/>

<xsl:template match="/">
 <xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>

Michael Kay
http://www.saxonica.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.