check condition in xslt

bidiboule

New Member
Below is the input XML (Little Big) sorry for the bigger input XML and as well as output xml\[code\]<tutorial><lessons> <lesson> chapter unit 1 page</lesson> <lesson> chapter unit 10~ page </lesson> <lesson> chapter unit page </lesson> <lesson> note lesson </lesson> <lessons1> <lesson> chapter unit 1 page </lesson> <lesson> description page </lesson> <lesson> chapter unit page </lesson></lessons1></lessons></tutorial>\[/code\]Below is my Output Xml\[code\]<?xml version="1.0" encoding="ISO-8859-1"?><Geography> <historical> <social> <toc1> <toc> <chapter>chapter</chapter> <unit>unit 1</unit> <pages>page</pages> </toc> <toc> <chapter>chapter</chapter> <unit>unit 10</unit> <pages>page</pages> </toc> <toc> <chapter>chapter</chapter> <unit>unit 10</unit> <pages>page</pages> </toc> <toc> <sample> <original>Note Lesson</orginal> </sample> </toc> </toc1> <toc2> <toc> <chapter>chapter</chapter> <unit>unit 1</unit> <pages>page</pages> </toc> <toc> <sample> <original>description page</orginal> </sample> </toc> <toc> <chapter>chapter</chapter> <unit>unit 10</unit> <pages>page</pages> </toc> </toc2> </social>\[/code\]It's quiet big output XML file sorry for that. In unit if i have unit 1 in output it will displayed as unit 1 but for example if i have unit10~ it will displayed as unit 10 the ~ has to removed if there is no value in by default it has to displayed unit 10.Little Brief ExplanationMy Output XML has to differentiate in three categories 1) Chapter 2) unit3) pages The input will be in three different types of formats 1) The XML have Chapter,unit(number with tilda symbol) & pages 2) The XML have Chapter,unit(number without tilda symbol) & pages 3) The XML have only pages ex..(note & description) so here if for example i have 10~(unit) the output will show 10, if the input xml doesn't have the value (for unit) in output xml it will show 10 as default number
 
Back
Top