Custom variable defined by XPath in Document Type Association
Posted: Fri Dec 28, 2012 7:34 am
I have frameworks which require custom variables throughout the authoring environment. There is currently no cohesive way to access a single set of key/value pairs in every type of language we work in: CSS, XSLT, XPath, Relax, etc.
In my particular case, the users are allowed to specify the server URL where assets are pulled from. This is done in a special configuration.xml file. Thus, in subsequent XML files, only the asset filename needs to be referenced. The folder structure is such that in XSLT I can make my way back up the hierarchy, find the configuration file, query for the proper server URL based on a prefix, concat the URL with the asset filename, and finally have the absolute URL.
Great acrobatics are needed to determine and validate if an asset exists by using Schematron due to the language constraints. If I wanted to display the asset image in the author editor window, the CSS would need to know how to jump through all of those hoops to get the absolute URL. (This is possible with an frightening oxy_xpath repeated x-number of times. I have assets spread throughout my stylesheet.)
What I'd like is a panel for variables that are tied to the framework through Document Type Association. Perhaps the variable could be evaluated as a constant string, an XPath expression, or a special namespace XSLT function. Thus, I can take great pains in defining an expression or function which takes into account the current URL, performs operations, and returns a result--but only do it in one place--not spread throughout CSS, XSLT, Schematron, etc.
I'd like to then reference that variable/function in a fairly uniform way, language permitting.
In my particular case, the users are allowed to specify the server URL where assets are pulled from. This is done in a special configuration.xml file. Thus, in subsequent XML files, only the asset filename needs to be referenced. The folder structure is such that in XSLT I can make my way back up the hierarchy, find the configuration file, query for the proper server URL based on a prefix, concat the URL with the asset filename, and finally have the absolute URL.
Great acrobatics are needed to determine and validate if an asset exists by using Schematron due to the language constraints. If I wanted to display the asset image in the author editor window, the CSS would need to know how to jump through all of those hoops to get the absolute URL. (This is possible with an frightening oxy_xpath repeated x-number of times. I have assets spread throughout my stylesheet.)
What I'd like is a panel for variables that are tied to the framework through Document Type Association. Perhaps the variable could be evaluated as a constant string, an XPath expression, or a special namespace XSLT function. Thus, I can take great pains in defining an expression or function which takes into account the current URL, performs operations, and returns a result--but only do it in one place--not spread throughout CSS, XSLT, Schematron, etc.
I'd like to then reference that variable/function in a fairly uniform way, language permitting.