Subject: Re: [xsl] Variable in XPath|
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 27 Jun 2007 19:19:25 +0200
For each attribute there has to be a variable, $id, $owner and $name in this case, which is set from commandline.
When writing the stylesheet I dont't know which classes are goint to be selected. This could be all classes, classes selected by id, classes selected by id and name, ect. So there are lots of possibilities - and even more if there are more attributes. The stylesheet would be very large if I would use a <xsl:when> for every possible combination.
So my idea was to use a default value for each variable, so that all (class) nodes are selected if the variable is not set.
I call saxon with $owner="1" $name="A" then $id is empty and I want the following test to return true:
<xsl:when test="doc('factbase.xml')/facts/class[@id eq $id and @owner eq $owner and @name eq $name]">
This will return false because $id is empty. My quesion is, is there a default value that I can put in the select of <xsl:variable name="id" select"?????"/> so that the test above will return true?
It would be great if that would work somehow because with lots of <xsl:when>s I think it would be much more complicated (considering more attributes).
Cheers, -- Abel Braaksma