Created
May 9, 2014 19:50
-
-
Save cfmitrah/1045bce91e1d795dfd2c to your computer and use it in GitHub Desktop.
Parse Adobe ColdFusion Documentation's TOC.xml file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
myxmldoc = XmlParse("#expandpath('.')#/toc.xml"); | |
if(listfirst(server.coldfusion.productversion) gte 10) | |
selectedElements = XmlSearch(myxmldoc, "//topic[ upper-case(@label) = '#ucase(url.q)#' ]"); | |
else | |
selectedElements = XmlSearch(myxmldoc, "//topic[ contains(translate(@label, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') ,'#lcase(url.q)#') ]/@href"); | |
</cfscript> | |
<cfif arrayLen(selectedElements) neq 0> | |
<cflocation url="#selectedElements[1].XmlAttributes.href#" addtoken="false"> | |
</cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment