[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Required item type of first argument of <function>
At 2010-02-19 13:52 -0800, Spencer Tickner wrote:
Ok, then if I make the template more generic.. ie: In my response I made it generic by declaring the type of the parameter as an item: <xsl:pram name="n" as="item()"/> <xsl:function name="qp:test" as="item()*" xmlns:functx="http://www.qplegaleze.ca"> <xsl:param name="n"/> Sure: <xsl:when test="$n instance of xsd:string"> ... but because your second <xsl:when> relies on $n being a node, I thought it safest to catch all atomic values by testing that the argument isn't a node. I tell my students to write their transformations defensively so as to catch unexpected inputs. I don't think it is safe to simply check only for a string because the next test is going to choke on atomic values of other types. I hope this helps. . . . . . . . . . . . . Ken
|
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
|