Hi all,

I've been working with CF & XML for a while now with no problem, but
now I'm needed to find out the position a node holds in it's parents
childList.

Now I want to be able to do this...

<!---   Load in the file --->
<cfobject type="COM" name="profilesXML" class="MSXML2.DOMDocument.4.0"
action="CREATE">
<cfset profilesXML.async = false>
<cfset rc = profilesXML.load("e:\xml\profiles.xml")>

<!--- select the profile node which which matches the values we've
been passed --->
<cfset thisProfile =
profilesXML.selectSingleNode("BUSINESSTYPES/group[@name=""#HTMLEditFor
mat(form.oldGroup)#""]/profile[@name=""#HTMLEditFormat(form.oldProfile
)#""]")>

<!---   get the position and depth of the node we've selected --->
<cfset thisPositon = profilesXML.childNumber(thisProfile)>
<cfset thisDepth = profilesXML.depth(thisProfile)>

But of course it doesn't work.

I could...
a) Move up to the parent, loop thru all the children until I get a
match while counting.  But I don't want to do this as I'm actually
going to be doing this in a loop while walking down a large(ish) XML
document.

possibly...
b) Somehow use a fragment of XLS and try and use something like...
<cfset thisPosition =
thisProfile.transformNode("<xsl:eval>childNumber(this)</xsl:eval>")

I think I'm going to have to use XLS in there somehow as that can use
childNumber, but how do get it to act upon a node I currently have
selected?  Without having to apply a whole XLS document to the whole
XML document?

Maybe I'm having a dim day, but any help would be greatfully received.

Cheers,
Dan.


-----------------------+
cf-xml mailing list
list: [EMAIL PROTECTED]
admin: [EMAIL PROTECTED]
home: http://torchbox.com/xml

Reply via email to