[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] commenting in xslt
Hi, I just had an idea about how to write useful comments in XSLT (which I very seldomly see), it struck me that what one needs to see in a complex transform is a comment that explains the expected input and the expected output, the reason being that the input is in a format that the developer working with the xslt might not know, or even if they have developed the stylesheet themselves might not remember the expected input, so: <xsl:template match="x:*[starts-with(@type,'payment')][1]"> <!-- if input = <x:restrictive type="paymentdue" amount="$500"/> the output will be <div class="paymentdue" onclick="calculator(paymentdue,500)"> paymentdue for $500 </div> the various types of class expected are paymentdue, paymentmade, paymentpast --> <div class="{@type}" onclick="calculator({concat(@type,',',substring(@amount,2,string-length(@amount)-1))})"> <xsl:value-of select="concat(@type,' for ',@amount)"/> </div> </xsl:template> yes I know this is not a particular good way to structure ones output, it's a spur of the moment example. Obviously the comment could be done as an xml fragment, so <!-- <doc:fragment> <doc:input> <x:restrictive type="paymentdue" amount="$500"/> </doc:input> <doc:output> <div class="paymentdue" onclick="calculator(paymentdue,500)"> paymentdue for $500 </div> </doc:output> <doc:remarks> the various types of class expected are paymentdue, paymentmade, paymentpast </doc:remarks> </doc:fragment> --> I haven't defined any namespaces for the examples. -- Bryan Rasmussen
|
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
|