[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Variable in XPath
Hi Andrew,
Thanks for your answer but it's not exactly that what I was looking for. Maybe I have to explain my problem a bit more. Consider again the following XML: <facts> <class id="2" owner="1" name="A"/> <class id="3" owner="1" name="B"/> <facts> This is a simple example, there might be input with nodes containing more attributes. 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. For example: 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). regards, Garvin On 6/27/07, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote:Seems like a long-winded way of just saying you want to check if <class> exists:
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|