This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: remove blank xmlns
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re:[xsl] remove blank xmlns
- From: Paul_B_Grimes at dot dot ca dot gov
- Date: Thu, 2 Aug 2001 14:36:41 -0700
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi Jeni,
Hopefully I'm not testing your patience too much. I definitely agree with
the notion of fixing the problem at its source (the asp code). I'm a
little hesitant to ask an asp question (this being an xsl list and all).
My original attempts to resolve this problem involved using createNode()
instead of createElement(). I had various problems with this (as usual,
most likely due to my lack of knowledge) after receiving multiple
syntactical errors, the best I could get was this:
error 438 Object doesn't support this property or method
Below (in red) are a few things I've tried that didn't work for me. Does
createNode() function properly on IIS? Can it only be used for the root
node? Does it only function properly if all createElement() calls are
replaced with createNode()? Once again, any help you can offer me makes me
extremely happy :)
Thank you,
Paul Grimes
Function addNewProjecttoXML(strXMLFilePath, strFileName)
'Declare local variables.
Dim objDom
Dim objRoot
Dim objRecord
Dim objprojectTitle
Dim objprojectNumber
Dim objdescription
Dim objstartDate
Dim objstartConvert
Dim objcompletionDate
Dim objcompletionConvert
Dim objcost
Dim objcontactName
Dim objcontactNumber
Dim objbranch
Dim objattdt
Dim objPI
Dim blnFileExists
Dim x
'Instantiate the Microsoft XMLDOM.
Set objDom = server.CreateObject("Microsoft.XMLDOM")
objDom.resolveExternals = False
objDom.preserveWhiteSpace = True
'Call the Load Method of the XMLDOM Object. The Load Method has a
'boolean return value indicating whether or not the file could be
'loaded. If the file exists and loads it will return true, otherwise,
'it will return false.
blnFileExists = objDom.Load(strXMLFilePath & "\" & strFileName)
'Test to see if the file loaded successfully.
If blnFileExists = True Then
'If the file loaded set the objRoot Object equal to the root element
'of the XML document.
Set objRoot = objDom.documentElement
Else
'Create your root element and append it to the XML document.
Set objRoot = objDom.createElement("current_projects")
objDom.appendChild objRoot
End If
'Create the new container element for the new record.
Set objRecord = objDom.createNode(1, 'project',
'x-schema:sortProjects-schema.xml')
'Set objRecord=objDom.createNode(NODE_ELEMENT,"project","")
'Set
objRecord=objDom.createNode(element,"project","x-schema:sortProjects-schem
a.xml")
objRoot.appendChild objRecord
'objRecord.setAttribute = "x-schema:sortProjects-schema.xml"
Hi Paul,
> I'm pretty new at the xsl thing and am having trouble fitting your
> suggestion into my existing xsl. It seems to me I would need to
> include the code within the <xsl:template
> match="p:current_projects"> or in the <xsl:for-each
> select="p:project">. But as I understand, <xsl:template match="">
> cannot be nested within another template (not sure exactly how that
> works). If you could kick me a little more in the right direction,
> that would be great. You have helped me tremendously in the past and
> your help is greatly appreciated.
You're right that templates can't be nested.
The root of your problem is that while it looks to you as if your XML
is just suffering from an extraneous attribute, actually the fact that
the attribute is a namespace declaration means that the source XML you
have differs significantly from the source XML that your stylesheet is
expecting. It's not just a matter of ignoring that attribute, you have
to somehow move the elements that are in the wrong namespace into the
right one.
Once again, the *best* way to fix the problem is to create elements in
the right namespace in the first place.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list