So I currently have an XSL which is parsed against a file called test.xml. Within the XSL I have a variable which selects a value from a different xml called creation_YYYY.xml (yyyy = year). Since the YYYY value of the creation file changes every year I can't hardcode a value within the XSL, so I use the year value found in the test.xml (which may or may not match the value of the creation xml). So the issue that i am having is that if the YYYY doesn't match the year value in the test.xml then the XSL crashes. So...
I have the following two XML's.
- test.xml
- creation_2010.xml (YYYY= 2010)
The year value in test.xml is 2009, so clearly the YYYY of the creation xml does not match, and the xsl currently doesn't run. What I want to do is something like: if year value in test.xml does not match creation_YYYY.xml then don't open the document(like an exception handler) and continue processing the rest of the code in the xsl.
Here is a snippet of the strucutre of test.xml
Code:
<xml file>
<date month="12" date="07"/>
<season year="2009"/>
etc...
</xml file>
In my XSL(which i parse against test.xml) I have the following code:
Code:
<xsl:variable name="YYYY" select="//season/@season"/>
<xsl:variable name="xmlTest" select="document(concat('Creation_', $YYYY, '.XML'))"/>
So I just wanted to know if there is some way of doing an exception on the xmlTest varaible if it does not exist.