SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    XML is all on one line

    I'm sure there's a solution for this but I'm not sure what keywords to look for.

    I have successfully exported some database info into an
    XML file with the appendchild method.

    However, the resulting file is xml tags in one long line - no tree structure - although it is technically correct when viewed through a browser.

    How do I make the XML file generate the normal indentation when it is being populated with code like

    Code ASP:
     
    ..
     
    Set nodeTemp = objXMLDoc.createElement("image")
    		nodeTemp.nodeTypedValue = objADORS.Fields("image").Value
    		nodepack.appendChild nodeTemp
     
    ...
     
    objXMLDoc.Save strFilePath
     
    ...

  2. #2
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found an answer. It can be transformed with this stylesheet

    Code XML:
    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="no" indent="yes"/>
        <xsl:template match="node()|@*">
          <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
          </xsl:copy>
        </xsl:template>
    </xsl:stylesheet>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •