1. 程式人生 > >Fallback tag in xslt by pran sukh on python hunter blog.

Fallback tag in xslt by pran sukh on python hunter blog.

Modular Programming is good attitude of best programmer. We often need to keep our code in modular approach so that is would be easy to maintain  and update or remove dead code and also it ease the process of bug tracking. XML and XSL processors provide freedom to import multiple imports to process the same XML 
document.
In the following XML data we have data from collage where student's and teacher's data is given. But we want to process the same XML data with different XSL files. Here in this example we want to show the teacher data in red backgroundcolor and student data ingreen backgroundcolor.

Data.xml

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36<?xml version = "1.0"?><?xml-stylesheet type = "text/xsl" href = "RootXSLT.xsl"?><data><DataForname ="Student"id ="001"><firstname>Dave</firstname><lastname>Walmod</lastname>…