Did you look at using the <CFXML> tag to turn the results of that into a
new document?
I'm not 100% sure the syntax below is correct, but the principle should
work.
<cfset nodeArray = xmlSearch(someDoc,someExpression)>
<cfxml variable="newDoc">
<article>
<cfloop from="1" to="#arrayLen(nodeArray)#" index="i">
#nodeArray[i].toString()#
</cfloop>
</article>
</cfxml>
Spike
Ian Skinner wrote:
> Does anybody know of a better way to return a single node from an XML document as a complete XML object in ColdFusion based on a certain parameter? I put together the following code and it works, but it just feels a kludge to me. It's late in the day and I think I went down a weird path and now I am lost and can not see the forest for the trees. I did try the xmlSearch() function, but it does not return an XML object and I need the returned node to be a full XML object of its own.
>
> CONTENTFORM.CFM
> ------
> <cffile action="" file="#GetDirectoryFromPath(GetCurrentTemplatePath())#Article.xsl" variable="articleXSLT">
> <cfset articleXSLT = replace(articleXSLT,"[[ID]]",form.articleID)>
> <cfset newArticle = xmlParse(xmlTransform(newArticle,articleXSLT))>
>
> ARTICLE.XSL
> -----
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="xml"/>
>
> <!--load the articles file -->
> <xsl:variable name="currentArticles" select="document('C:\WebSites\Resources\Data\XML\FrontPageArticles.xml')"/>
>
> <!-- return one article -->
> <xsl:template match="/">
> <xsl:param name="articleID" select="'[[ID]]'"/>
> <articles>
> <xsl:copy-of select="$currentArticles/articles/[EMAIL PROTECTED]"/>
> </articles>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> "C code. C code run. Run code run. Please!"
> - Cynthia Dunning
>
> Confidentiality Notice: This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message.
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

