[xsl] Building XML DOM from Access DB column with mixed content

Subject: [xsl] Building XML DOM from Access DB column with mixed content
From: "Doug Howell" <doug@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 13 Nov 2001 11:37:49 -0500
Do any of you have any direction for me on this problem:

I have a glossary.xml file which I've been parsing and transforming on the
IE 5 client. Now, for a test, I'm implementing it via an ASP page, parsing
and transforming on the server, and storing the glossary in an Access
database. I'm building a DOM, transforming it, then including the string
result into the document. I've got the mechanics of it working, but I've run
into a problem. If one of you could steer me in the right direction, I'd
really appreciate it.

I'm storing several of the XML elements in their own columns in the Access
DB ("term," etc.). The trouble is that the "definition" element has child
elements which I'm not breaking out into their own columns. In other words,
the Definition field in my DB has child elements (such as "<em>," "<uri>,"
etc.) within it, as well as entity references. This means that when I create
a "definition" element from the Definition field, the embedded child
elements and entity references are not parsed like they were in my XML file,
but are treated like text.

Is there a way to parse the contents of the Definition field "on its way" to
the DOM document, so these elements/entity refs will be transformed
correctly to the HTML output?

Doug Howell

Here's part of the code: (I'm using MSXML3 SP1)

'create XML doc from SQL results
dim root
dim entry
dim newElem
dim newAttrib
dim i

Set root = gobjXML.documentElement

i = 0
While Not objRS.EOF
 Set newElem = gobjXML.createElement("entry") 'create a new entry
 root.appendChild newElem
 Set newElem = gobjXML.createElement("term") 'create the term element
 root.childNodes.Item(i).appendChild newElem
 root.childNodes.Item(i).lastChild.Text = objRS("Term")
 Set newElem = gobjXML.createElement("definition")
 root.childNodes.Item(i).appendChild newElem
 root.childNodes.Item(i).lastChild.Text = objRS("Definition")
 i = i + 1
Set objRS = Nothing
Set objConn = Nothing
'do the transformation and write the results into the page below
strResult = gobjXML.transformNode(gobjXSL)


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

Current Thread