It's from a CFDJ article, "Transforming XML, Part 3" by David Grassner in
CFDJ Volume 4 Issue 8.  

<!--- Listing 1: XMLIndent()
  requires one argument of type XML
  returns the resulting XML as text --->
<cffunction name="XMLIndent" returntype="string">
<cfargument name="xml" type="string" required="Yes">

<cfset xsl='<?xml version="1.0"?>
  <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:xalan="http://xml.apache.org/xslt">
   <xsl:output indent="yes" xalan:indent-amount="2"/>
    <xsl:template match="/">
     <xsl:copy-of select="."/>
    </xsl:template>
  </xsl:stylesheet>'>
<cfset output=xmltransform(arguments.xml, xsl)>
<cfreturn output>

</cffunction>

SYS-CON sells a CF resource cd that has all of their old articles and code
samples.  It's well worth the money, even if you have all the magazines.

http://www.jdjstore.com/colrescd.html


HTH,

Sam


----------------------------------------------
Blog:  http://www.rewindlife.com
Chart: http://www.blinex.com/products/charting
----------------------------------------------



> -----Original Message-----
> From: Glen Salisbury [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 25, 2003 2:45 PM
> To: CF-Talk
> Subject: XML String Formatting
>
> Some where in the million sites I look at each day.
> (maybe not quite that many sites but somewhere).
>
> Someone wrote a niffty little function to format XML with
> proper indentation for the proposed of easy readablity.
>
> Anyone happen to know who/where I'd find that function.
>
> Thanks,
> Glen Salisbury
>

[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to