xs3p.xsl 349 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522
  1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2. <!--
  3. Copyright (C) DSTC Pty Ltd (ACN 052 372 577) 2002
  4. The software contained on this media is the property of the
  5. DSTC Pty Ltd. Use of this software is strictly in accordance
  6. with the license agreement in the accompanying LICENSE file.
  7. If your distribution of this software does not contain a
  8. LICENSE file then you have no rights to use this software
  9. in any manner and should contact DSTC at the address below
  10. to determine an appropriate licensing arrangement.
  11. DSTC Pty Ltd
  12. Level 7, General Purpose South
  13. The University of Queensland
  14. QLD 4072 Australia
  15. Tel: +61 7 3365 4310
  16. Fax: +61 7 3365 4311
  17. Email: titanium_enquiries@dstc.edu.au
  18. This software is being provided "AS IS" without warranty of
  19. any kind. In no event shall DSTC Pty Ltd be liable for
  20. damage of any kind arising out of or in connection with
  21. the use or performance of this software.
  22. -->
  23. <!--
  24. File:
  25. xs3p.xsl
  26. Description:
  27. Stylesheet that generates XHTML documentation, given an XML
  28. Schema document
  29. Assumptions:
  30. -Resulting documentation will only be displayed properly with
  31. the latest browsers that support XHTML and CSS. Older
  32. browsers are not supported.
  33. -Assumed that XSD document conforms to the XSD recommendation.
  34. No validity checking is done.
  35. Constraints:
  36. -Local schema components cannot contain two dashes in
  37. 'documentation' elements within their 'annotation' element.
  38. This is because the contents of those 'documentation'
  39. elements are displayed in a separate window using Javascript.
  40. This Javascript code is enclosed in comments, which do not
  41. allow two dashes inside themselves.
  42. Notes:
  43. -Javascript code is placed within comments, even though in
  44. strict XHTML, JavaScript code should be placed within CDATA
  45. sections. This is because current browsers generate a syntax
  46. error if the page contains CDATA sections. Placing Javascript
  47. code within comments means that the code cannot contain two
  48. dashes.
  49. (See 'PrintJSCode' named template.)
  50. Stylesheet Sections:
  51. -Global Parameters
  52. Specify parameters that can be set externally to customise
  53. stylesheet
  54. -Constants
  55. Constants used by the stylesheet
  56. -Main Document
  57. Templates to generate the overall document and the top-level
  58. sections within it
  59. -Hierarchy table
  60. Templates for displaying type hierarchy for simple and
  61. complex types, and substitution group hierarchy for elements
  62. -Properties table
  63. Templates for displaying the properties of top-level schema
  64. components
  65. -XML Instance Representation table
  66. Templates for displaying how an XML instance conforming to
  67. the schema component would look like
  68. -Schema Component Representation table
  69. Templates for displaying the XML representation of the schema
  70. component
  71. -XML Pretty Printer
  72. Templates for displaying arbitrary XML instances
  73. -Handling Schema Component References
  74. Templates for generating internal and external links
  75. -General Utility Templates
  76. General templates used by other templates in this stylesheet
  77. To Do List:
  78. -It is not clever when printing out element and attribute
  79. wildcards in the XML Instance Representation tables. It prints
  80. out all wildcards, rather than working out the actual wildcard
  81. is from multiple wildcard instances.
  82. -Same as above for simple type constraints, e.g. it doesn't
  83. summarise multiple pattern constraints.
  84. -->
  85. <xsl:stylesheet
  86. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  87. xmlns="http://www.w3.org/1999/xhtml"
  88. xmlns:html="http://www.w3.org/1999/xhtml"
  89. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  90. xmlns:ppp="http://titanium.dstc.edu.au/xml/xs3p"
  91. xmlns:xs3p="http://titanium.dstc.edu.au/xml/xs3p"
  92. version="1.0"
  93. exclude-result-prefixes="xsd ppp html">
  94. <xsl:output
  95. method="xml"
  96. encoding="ISO-8859-1"
  97. standalone="yes"
  98. version="1.0"
  99. doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
  100. doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  101. indent="yes"/>
  102. <xsl:key name="type" match="/xsd:schema/xsd:complexType | /xsd:schema/xsd:simpleType | /xsd:schema/xsd:redefine/xsd:complexType | /xsd:schema/xsd:redefine/xsd:simpleType" use="@name" />
  103. <xsl:key name="complexType" match="/xsd:schema/xsd:complexType | /xsd:schema/xsd:redefine/xsd:complexType" use="@name" />
  104. <xsl:key name="simpleType" match="/xsd:schema/xsd:simpleType | /xsd:schema/xsd:redefine/xsd:simpleType" use="@name" />
  105. <xsl:key name="attributeGroup" match="/xsd:schema/xsd:attributeGroup | /xsd:schema/xsd:redefine/xsd:attributeGroup" use="@name" />
  106. <xsl:key name="group" match="/xsd:schema/xsd:group | /xsd:schema/xsd:redefine/xsd:group" use="@name" />
  107. <xsl:key name="attribute" match="/xsd:schema/xsd:attribute" use="@name" />
  108. <xsl:key name="element" match="/xsd:schema/xsd:element" use="@name" />
  109. <!-- ******** Global Parameters ******** -->
  110. <!-- Title of XHTML document. -->
  111. <xsl:param name="title" select="/xsd:schema/xsd:annotation/xsd:appinfo/xs3p:title"></xsl:param>
  112. <!-- If 'true', sorts the top-level schema components by type,
  113. then name. Otherwise, displays the components by the order that
  114. they appear in the schema. -->
  115. <xsl:param name="sortByComponent">true</xsl:param>
  116. <!-- If 'true', XHTML document uses JavaScript for added
  117. functionality, such as pop-up windows and information-
  118. hiding.
  119. Otherwise, XHTML document does not use JavaScript. -->
  120. <xsl:param name="useJavaScript">true</xsl:param>
  121. <!-- If 'true', prints all super-types in the
  122. type hierarchy box.
  123. Otherwise, prints the parent type only in the
  124. type hierarchy box. -->
  125. <xsl:param name="printAllSuperTypes">true</xsl:param>
  126. <!-- If 'true', prints all sub-types in the
  127. type hierarchy box.
  128. Otherwise, prints the direct sub-types only in the
  129. type hierarchy box. -->
  130. <xsl:param name="printAllSubTypes">true</xsl:param>
  131. <!-- If 'true', prints out the Glossary section. -->
  132. <xsl:param name="printGlossary" select="/xsd:schema/xsd:annotation/xsd:appinfo/xs3p:printGlossary">true</xsl:param>
  133. <!-- If 'true', prints out the Legend section. -->
  134. <xsl:param name="printLegend" select="/xsd:schema/xsd:annotation/xsd:appinfo/xs3p:printLegend">true</xsl:param>
  135. <!-- If 'true', prints prefix matching namespace of schema
  136. components in XML Instance Representation tables. -->
  137. <xsl:param name="printNSPrefixes">true</xsl:param>
  138. <!-- If 'true', searches 'included' schemas for schema components
  139. when generating links and XML Instance Representation tables. -->
  140. <xsl:param name="searchIncludedSchemas">false</xsl:param>
  141. <!-- If 'true', searches 'imported' schemas for schema components
  142. when generating links and XML Instance Representation tables. -->
  143. <xsl:param name="searchImportedSchemas">false</xsl:param>
  144. <!-- File containing the mapping from file locations of external
  145. (e.g. included, imported, refined) schemas to file locations
  146. of their XHTML documentation. -->
  147. <xsl:param name="linksFile"></xsl:param>
  148. <!-- Set the base URL for resolving links. -->
  149. <xsl:param name="baseURL"></xsl:param>
  150. <!-- Uses an external CSS stylesheet rather than using
  151. internally-declared CSS properties. -->
  152. <xsl:param name="externalCSSURL"></xsl:param>
  153. <!-- ******** Constants ******** -->
  154. <!-- XML Schema Namespace -->
  155. <xsl:variable name="XSD_NS">http://www.w3.org/2001/XMLSchema</xsl:variable>
  156. <!-- XML Namespace -->
  157. <xsl:variable name="XML_NS">http://www.w3.org/XML/1998/namespace</xsl:variable>
  158. <!-- Number of 'em' to indent from parent element's start tag to
  159. child element's start tag -->
  160. <xsl:variable name="ELEM_INDENT">1.5</xsl:variable>
  161. <!-- Number of 'em' to indent from parent element's start tag to
  162. attribute's tag -->
  163. <xsl:variable name="ATTR_INDENT">0.5</xsl:variable>
  164. <!-- Title to use if none provided -->
  165. <xsl:variable name="DEFAULT_TITLE">XML Schema Documentation</xsl:variable>
  166. <!-- Prefixes used for anchor names -->
  167. <!-- Type definitions -->
  168. <xsl:variable name="TYPE_PREFIX">type_</xsl:variable>
  169. <!-- Attribute declarations -->
  170. <xsl:variable name="ATTR_PREFIX">attribute_</xsl:variable>
  171. <!-- Attribute group definitions -->
  172. <xsl:variable name="ATTR_GRP_PREFIX">attributeGroup_</xsl:variable>
  173. <!-- Complex type definitions -->
  174. <xsl:variable name="CTYPE_PREFIX" select="$TYPE_PREFIX"/>
  175. <!-- Element declarations -->
  176. <xsl:variable name="ELEM_PREFIX">element_</xsl:variable>
  177. <!-- Key definitions -->
  178. <xsl:variable name="KEY_PREFIX">key_</xsl:variable>
  179. <!-- Group definitions -->
  180. <xsl:variable name="GRP_PREFIX">group_</xsl:variable>
  181. <!-- Notations -->
  182. <xsl:variable name="NOTA_PREFIX">notation_</xsl:variable>
  183. <!-- Namespace declarations -->
  184. <xsl:variable name="NS_PREFIX">ns_</xsl:variable>
  185. <!-- Simple type definitions -->
  186. <xsl:variable name="STYPE_PREFIX" select="$TYPE_PREFIX"/>
  187. <!-- Glossary terms -->
  188. <xsl:variable name="TERM_PREFIX">term_</xsl:variable>
  189. <!-- The original schema needs to be stored because when
  190. calculating links for references, the links have to be
  191. relative to the original schema. See 'PrintCompRef'
  192. template. -->
  193. <xsl:variable name="ORIGINAL_SCHEMA" select="/xsd:schema"/>
  194. <!-- ******** Main Document ******** -->
  195. <!--
  196. Main template that starts the process
  197. -->
  198. <xsl:template match="/xsd:schema">
  199. <!-- Check that links file is provided if searching external
  200. schemas for components. -->
  201. <xsl:if test="$linksFile='' and (normalize-space(translate($searchIncludedSchemas, 'TRUE', 'true'))='true' or normalize-space(translate($searchImportedSchemas, 'TRUE', 'true'))='true')">
  202. <xsl:call-template name="HandleError">
  203. <xsl:with-param name="isTerminating">true</xsl:with-param>
  204. <xsl:with-param name="errorMsg">
  205. 'linksFile' variable must be provided if either
  206. 'searchIncludedSchemas' or 'searchImportedSchemas' is true.
  207. </xsl:with-param>
  208. </xsl:call-template>
  209. </xsl:if>
  210. <!-- Get title of document -->
  211. <xsl:variable name="actualTitle">
  212. <xsl:choose>
  213. <xsl:when test="$title != ''">
  214. <xsl:value-of select="$title"/>
  215. </xsl:when>
  216. <xsl:otherwise>
  217. <xsl:value-of select="$DEFAULT_TITLE"/>
  218. </xsl:otherwise>
  219. </xsl:choose>
  220. </xsl:variable>
  221. <html>
  222. <head>
  223. <!-- Set title bar -->
  224. <title><xsl:value-of select="$actualTitle"/></title>
  225. <!-- Set content type -->
  226. <meta http-equiv="Content-Type" content="text/xml; charset=iso-8859-1"/>
  227. <!-- Set base URL to use in working out relative paths -->
  228. <xsl:if test="$baseURL != ''">
  229. <xsl:element name="base">
  230. <xsl:attribute name="href"><xsl:value-of select="$baseURL"/></xsl:attribute>
  231. </xsl:element>
  232. </xsl:if>
  233. <!-- Set CSS styles -->
  234. <style type="text/css">
  235. <xsl:choose>
  236. <!-- Use external CSS stylesheet -->
  237. <xsl:when test="$externalCSSURL != ''">
  238. <xsl:text>
  239. @import url(</xsl:text><xsl:value-of select="$externalCSSURL"/><xsl:text>);
  240. </xsl:text>
  241. </xsl:when>
  242. <!-- Use internal CSS styles -->
  243. <xsl:otherwise>
  244. <xsl:call-template name="DocumentCSSStyles"/>
  245. </xsl:otherwise>
  246. </xsl:choose>
  247. </style>
  248. <!-- Add Javascript code to make the collapseable boxes work -->
  249. <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
  250. <xsl:call-template name="PrintJSCode">
  251. <xsl:with-param name="code">
  252. <xsl:call-template name="DocumentJSCode"/>
  253. </xsl:with-param>
  254. </xsl:call-template>
  255. </xsl:if>
  256. </head>
  257. <body>
  258. <!-- Title -->
  259. <h1><a name="top"><xsl:value-of select="$actualTitle"/></a></h1>
  260. <!-- Buttons for displaying printer-friendly version, and
  261. expanding and collapsing all boxes -->
  262. <xsl:call-template name="GlobalControlButtons"/>
  263. <!-- Section: Table of Contents -->
  264. <h2>Table of Contents</h2>
  265. <xsl:apply-templates select="." mode="toc"/>
  266. <xsl:call-template name="SectionFooter"/>
  267. <!-- Section: Schema Document Properties -->
  268. <h2><a name="SchemaProperties">Schema Document Properties</a></h2>
  269. <!-- Sub-section: Properties table -->
  270. <xsl:apply-templates select="." mode="properties"/>
  271. <!-- Sub-section: Namespace Legend -->
  272. <h3>Declared Namespaces</h3>
  273. <xsl:apply-templates select="." mode="namespaces"/>
  274. <!-- Sub-section: Schema Component Representation table -->
  275. <xsl:call-template name="SchemaComponentTable">
  276. <xsl:with-param name="component" select="."/>
  277. </xsl:call-template>
  278. <xsl:call-template name="SectionFooter"/>
  279. <!-- Section: Redefined Schema Components -->
  280. <xsl:if test="xsd:redefine">
  281. <h2><a name="Redefinitions">Redefined Schema Components</a></h2>
  282. <xsl:apply-templates select="xsd:redefine/xsd:simpleType | xsd:redefine/xsd:complexType | xsd:redefine/xsd:attributeGroup | xsd:redefine/xsd:group" mode="topSection"/>
  283. </xsl:if>
  284. <!-- Sections: Top-level Schema Components -->
  285. <xsl:choose>
  286. <!-- Sort schema components -->
  287. <xsl:when test="normalize-space(translate($sortByComponent,'TRUE','true'))='true'">
  288. <!-- Declarations -->
  289. <xsl:if test="xsd:attribute or xsd:element">
  290. <h2><a name="SchemaDeclarations">Global Declarations</a></h2>
  291. <xsl:apply-templates select="xsd:attribute | xsd:element" mode="topSection">
  292. <xsl:sort select="local-name(.)" order="ascending"/>
  293. <xsl:sort select="@name" order="ascending"/>
  294. </xsl:apply-templates>
  295. </xsl:if>
  296. <!-- Definitions -->
  297. <xsl:if test="xsd:attributeGroup or xsd:complexType or xsd:group or xsd:notation or xsd:simpleType">
  298. <h2><a name="SchemaDefinitions">Global Definitions</a></h2>
  299. <xsl:apply-templates select="xsd:attributeGroup | xsd:complexType | xsd:group | xsd:notation | xsd:simpleType" mode="topSection">
  300. <xsl:sort select="local-name(.)" order="ascending"/>
  301. <xsl:sort select="@name" order="ascending"/>
  302. </xsl:apply-templates>
  303. </xsl:if>
  304. </xsl:when>
  305. <!-- Display schema components as they occur -->
  306. <xsl:otherwise>
  307. <h2><a name="SchemaComponents">Global Schema Components</a></h2>
  308. <xsl:apply-templates select="xsd:attribute | xsd:attributeGroup | xsd:complexType | xsd:element | xsd:group | xsd:notation | xsd:simpleType" mode="topSection"/>
  309. </xsl:otherwise>
  310. </xsl:choose>
  311. <!-- Section: Legend -->
  312. <xsl:if test="normalize-space(translate($printLegend,'TRUE','true'))='true'">
  313. <div id="legend">
  314. <h2><a name="Legend">Legend</a></h2>
  315. <xsl:call-template name="Legend"/>
  316. <xsl:call-template name="SectionFooter"/>
  317. </div>
  318. </xsl:if>
  319. <!-- Section: Glossary -->
  320. <xsl:if test="normalize-space(translate($printGlossary,'TRUE','true'))='true'">
  321. <div id="glossary">
  322. <h2><a name="Glossary">Glossary</a></h2>
  323. <xsl:call-template name="Glossary"/>
  324. <xsl:call-template name="SectionFooter"/>
  325. </div>
  326. </xsl:if>
  327. <!-- Document Footer -->
  328. <p class="footer">
  329. <xsl:text>Generated by </xsl:text>
  330. <a href="http://xml.fiforms.org/xs3p/">xs3p</a> (<a href="http://titanium.dstc.edu.au/xml/xs3p">old link</a>)
  331. <xsl:text>.</xsl:text>
  332. <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
  333. <xsl:text> Last modified: </xsl:text>
  334. <xsl:call-template name="PrintJSCode">
  335. <xsl:with-param name="code">document.write(document.lastModified);</xsl:with-param>
  336. </xsl:call-template>
  337. </xsl:if>
  338. </p>
  339. </body>
  340. </html>
  341. </xsl:template>
  342. <!--
  343. Prints out the table of Declared Namespaces for the
  344. current schema.
  345. -->
  346. <xsl:template match="xsd:schema" mode="namespaces">
  347. <table class="namespaces">
  348. <tr>
  349. <th>Prefix</th>
  350. <th>Namespace</th>
  351. </tr>
  352. <!-- Default namespace (no prefix) -->
  353. <xsl:if test="namespace::*[local-name(.)='']">
  354. <xsl:variable name="ns" select="namespace::*[local-name(.)='']"/>
  355. <tr>
  356. <td>
  357. <a name="{$NS_PREFIX}">Default namespace</a>
  358. </td>
  359. <td>
  360. <xsl:choose>
  361. <xsl:when test="/xsd:schema/@targetNamespace and $ns=normalize-space(/xsd:schema/@targetNamespace)">
  362. <span class="targetNS">
  363. <xsl:value-of select="$ns"/>
  364. </span>
  365. </xsl:when>
  366. <xsl:otherwise>
  367. <xsl:value-of select="$ns"/>
  368. </xsl:otherwise>
  369. </xsl:choose>
  370. </td>
  371. </tr>
  372. </xsl:if>
  373. <!-- Namespaces with prefixes -->
  374. <xsl:for-each select="namespace::*[local-name(.)!='']">
  375. <xsl:variable name="prefix" select="local-name(.)"/>
  376. <xsl:variable name="ns" select="."/>
  377. <tr>
  378. <td>
  379. <a name="{concat($NS_PREFIX, $prefix)}">
  380. <xsl:value-of select="$prefix"/>
  381. </a>
  382. </td>
  383. <td>
  384. <xsl:choose>
  385. <xsl:when test="/xsd:schema/@targetNamespace and $ns=normalize-space(/xsd:schema/@targetNamespace)">
  386. <span class="targetNS">
  387. <xsl:value-of select="$ns"/>
  388. </span>
  389. </xsl:when>
  390. <xsl:otherwise>
  391. <xsl:value-of select="$ns"/>
  392. </xsl:otherwise>
  393. </xsl:choose>
  394. </td>
  395. </tr>
  396. </xsl:for-each>
  397. </table>
  398. </xsl:template>
  399. <!--
  400. Prints out the Table of Contents.
  401. -->
  402. <xsl:template match="xsd:schema" mode="toc">
  403. <ul>
  404. <!-- Section: Schema Document Properties -->
  405. <li>
  406. <a href="#SchemaProperties">Schema Document Properties</a>
  407. </li>
  408. <!-- Section: Redefined Schema Components -->
  409. <xsl:if test="xsd:redefine">
  410. <li>
  411. <a href="#Redefinitions">Redefined Schema Components</a>
  412. </li>
  413. </xsl:if>
  414. <!-- Sections: Top-level Schema Components -->
  415. <xsl:choose>
  416. <!-- Sort schema components -->
  417. <xsl:when test="normalize-space(translate($sortByComponent,'TRUE','true'))='true'">
  418. <!-- Declarations -->
  419. <xsl:if test="xsd:attribute or xsd:element">
  420. <li><a href="#SchemaDeclarations">Global Declarations</a>
  421. <ul>
  422. <xsl:apply-templates select="xsd:attribute | xsd:element" mode="toc">
  423. <xsl:sort select="local-name(.)" order="ascending"/>
  424. <xsl:sort select="@name" order="ascending"/>
  425. </xsl:apply-templates>
  426. </ul>
  427. </li>
  428. </xsl:if>
  429. <!-- Definitions -->
  430. <xsl:if test="xsd:attributeGroup or xsd:complexType or xsd:group or xsd:notation or xsd:simpleType">
  431. <li><a href="#SchemaDefinitions">Global Definitions</a>
  432. <ul>
  433. <xsl:apply-templates select="xsd:attributeGroup | xsd:complexType | xsd:group | xsd:notation | xsd:simpleType" mode="toc">
  434. <xsl:sort select="local-name(.)" order="ascending"/>
  435. <xsl:sort select="@name" order="ascending"/>
  436. </xsl:apply-templates>
  437. </ul>
  438. </li>
  439. </xsl:if>
  440. </xsl:when>
  441. <!-- Display schema components in order as they appear in schema -->
  442. <xsl:otherwise>
  443. <li><a href="#SchemaComponents">Global Schema Components</a>
  444. <ul>
  445. <xsl:apply-templates select="xsd:attribute | xsd:attributeGroup | xsd:complexType | xsd:element | xsd:group | xsd:notation | xsd:simpleType" mode="toc"/>
  446. </ul>
  447. </li>
  448. </xsl:otherwise>
  449. </xsl:choose>
  450. </ul>
  451. <!-- Section: Legend -->
  452. <xsl:if test="normalize-space(translate($printLegend,'TRUE','true'))='true'">
  453. <ul id="legendTOC" style="margin-top: 0em">
  454. <li><a href="#Legend">Legend</a></li>
  455. </ul>
  456. </xsl:if>
  457. <!-- Section: Glossary -->
  458. <xsl:if test="normalize-space(translate($printGlossary,'TRUE','true'))='true'">
  459. <ul id="glossaryTOC" style="margin-top: 0em">
  460. <li><a href="#Glossary">Glossary</a></li>
  461. </ul>
  462. </xsl:if>
  463. </xsl:template>
  464. <!--
  465. Prints out a link to a top-level schema component section in the
  466. Table of Contents.
  467. -->
  468. <xsl:template match="xsd:*[@name]" mode="toc">
  469. <xsl:variable name="componentID">
  470. <xsl:call-template name="GetComponentID">
  471. <xsl:with-param name="component" select="."/>
  472. </xsl:call-template>
  473. </xsl:variable>
  474. <li>
  475. <a href="#{$componentID}">
  476. <xsl:call-template name="GetComponentDescription">
  477. <xsl:with-param name="component" select="."/>
  478. </xsl:call-template>
  479. <xsl:text>: </xsl:text>
  480. <strong><xsl:value-of select="@name"/></strong>
  481. </a>
  482. </li>
  483. </xsl:template>
  484. <!--
  485. Prints out the section for a top-level schema component.
  486. -->
  487. <xsl:template match="xsd:*[@name]" mode="topSection">
  488. <!-- Header -->
  489. <xsl:call-template name="ComponentSectionHeader">
  490. <xsl:with-param name="component" select="."/>
  491. </xsl:call-template>
  492. <!-- Hierarchy table (for types and elements) -->
  493. <xsl:apply-templates select="." mode="hierarchy"/>
  494. <!-- Properties table -->
  495. <xsl:apply-templates select="." mode="properties"/>
  496. <!-- XML Instance Representation table -->
  497. <xsl:call-template name="SampleInstanceTable">
  498. <xsl:with-param name="component" select="."/>
  499. </xsl:call-template>
  500. <!-- Schema Component Representation table -->
  501. <xsl:call-template name="SchemaComponentTable">
  502. <xsl:with-param name="component" select="."/>
  503. </xsl:call-template>
  504. <!-- Footer -->
  505. <xsl:call-template name="SectionFooter"/>
  506. </xsl:template>
  507. <!--
  508. Prints out the buttons that can expand and collapse all boxes in
  509. this page.
  510. -->
  511. <xsl:template name="GlobalControlButtons">
  512. <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
  513. <div style="float: right;">
  514. <!-- Printer-friendly Version -->
  515. <div id="printerControls" style="display:none;">
  516. <input type="checkbox" onclick="displayMode(this.checked)"/>
  517. <xsl:text>Printer-friendly Version</xsl:text>
  518. </div>
  519. <xsl:call-template name="PrintJSCode">
  520. <xsl:with-param name="code">
  521. var pc = getElementObject("printerControls");
  522. if (pc != null) {
  523. pc.style.display="block";
  524. }
  525. </xsl:with-param>
  526. </xsl:call-template>
  527. <!-- Expand/Collapse All buttons -->
  528. <div id="globalControls" style="display:none">
  529. <strong>XML Instance Representation:</strong><br/>
  530. <span style="margin-left: 1em; white-space: nowrap">
  531. <xsl:text>[ </xsl:text>
  532. <a href="javascript:void(0)" onclick="expandAll(xiBoxes)">Expand All</a>
  533. <xsl:text> | </xsl:text>
  534. <a href="javascript:void(0)" onclick="collapseAll(xiBoxes)">Collapse All</a>
  535. <xsl:text> ]</xsl:text>
  536. </span><br/><br/>
  537. <strong>Schema Component Representation:</strong><br/>
  538. <span style="margin-left: 1em; white-space: nowrap">
  539. <xsl:text>[ </xsl:text>
  540. <a href="javascript:void(0)" onclick="expandAll(scBoxes)">Expand All</a>
  541. <xsl:text> | </xsl:text>
  542. <a href="javascript:void(0)" onclick="collapseAll(scBoxes)">Collapse All</a>
  543. <xsl:text> ]</xsl:text>
  544. </span>
  545. </div>
  546. <xsl:call-template name="PrintJSCode">
  547. <xsl:with-param name="code">
  548. var gc = getElementObject("globalControls");
  549. if (gc != null) {
  550. gc.style.display="block";
  551. }
  552. </xsl:with-param>
  553. </xsl:call-template>
  554. </div>
  555. </xsl:if>
  556. </xsl:template>
  557. <!--
  558. Prints out the section header of a top-level schema component.
  559. Param(s):
  560. component (Node) required
  561. Top-level schema component
  562. -->
  563. <xsl:template name="ComponentSectionHeader">
  564. <xsl:param name="component"/>
  565. <xsl:variable name="componentID">
  566. <xsl:call-template name="GetComponentID">
  567. <xsl:with-param name="component" select="$component"/>
  568. </xsl:call-template>
  569. </xsl:variable>
  570. <xsl:variable name="componentDescription">
  571. <xsl:call-template name="GetComponentDescription">
  572. <xsl:with-param name="component" select="$component"/>
  573. </xsl:call-template>
  574. </xsl:variable>
  575. <xsl:variable name="componentTermRef">
  576. <xsl:call-template name="GetComponentTermRef">
  577. <xsl:with-param name="component" select="$component"/>
  578. </xsl:call-template>
  579. </xsl:variable>
  580. <h3>
  581. <!-- Description -->
  582. <xsl:choose>
  583. <xsl:when test="$componentTermRef != ''">
  584. <xsl:call-template name="PrintGlossaryTermRef">
  585. <xsl:with-param name="code" select="$componentTermRef"/>
  586. <xsl:with-param name="term" select="$componentDescription"/>
  587. </xsl:call-template>
  588. </xsl:when>
  589. <xsl:otherwise>
  590. <xsl:value-of select="$componentDescription"/>
  591. </xsl:otherwise>
  592. </xsl:choose>
  593. <xsl:text>: </xsl:text>
  594. <!-- Name -->
  595. <a name="{$componentID}" class="name">
  596. <xsl:value-of select="$component/@name"/>
  597. </a>
  598. </h3>
  599. </xsl:template>
  600. <!--
  601. Prints out footer for top-level sections.
  602. -->
  603. <xsl:template name="SectionFooter">
  604. <!-- Link to top of page-->
  605. <div style="text-align: right; clear: both;"><a href="#top">top</a></div>
  606. <hr/>
  607. </xsl:template>
  608. <!--
  609. Java Script code required by the entire HTML document.
  610. -->
  611. <xsl:template name="DocumentJSCode">
  612. <!-- Get all IDs of XML Instance Representation boxes
  613. and place them in an array. -->
  614. <xsl:text>/* IDs of XML Instance Representation boxes */
  615. </xsl:text>
  616. <xsl:text>var xiBoxes = new Array(</xsl:text>
  617. <xsl:for-each select="/xsd:schema/xsd:*[@name]">
  618. <xsl:if test="position()!=1">
  619. <xsl:text>, </xsl:text>
  620. </xsl:if>
  621. <xsl:text>'</xsl:text>
  622. <xsl:call-template name="GetComponentID">
  623. <xsl:with-param name="component" select="."/>
  624. </xsl:call-template>
  625. <xsl:text>_xibox'</xsl:text>
  626. </xsl:for-each>
  627. <xsl:text>);
  628. </xsl:text>
  629. <!-- Get all IDs of Schema Component Representation boxes
  630. and place them in an array. -->
  631. <xsl:text>/* IDs of Schema Component Representation boxes */
  632. </xsl:text>
  633. <xsl:text>var scBoxes = new Array('schema_scbox'</xsl:text>
  634. <xsl:for-each select="/xsd:schema/xsd:*[@name]">
  635. <xsl:text>, '</xsl:text>
  636. <xsl:call-template name="GetComponentID">
  637. <xsl:with-param name="component" select="."/>
  638. </xsl:call-template>
  639. <xsl:text>_scbox'</xsl:text>
  640. </xsl:for-each>
  641. <xsl:text>);
  642. </xsl:text>
  643. <!-- Functions -->
  644. <xsl:text>
  645. /**
  646. * Can get the ID of the button controlling
  647. * a collapseable box by concatenating
  648. * this string onto the ID of the box itself.
  649. */
  650. var B_SFIX = "_button";
  651. /**
  652. * Counter of documentation windows
  653. * Used to give each window a unique name
  654. */
  655. var windowCount = 0;
  656. /**
  657. * Returns an element in the current HTML document.
  658. *
  659. * @param elementID Identifier of HTML element
  660. * @return HTML element object
  661. */
  662. function getElementObject(elementID) {
  663. var elemObj = null;
  664. if (document.getElementById) {
  665. elemObj = document.getElementById(elementID);
  666. }
  667. return elemObj;
  668. }
  669. /**
  670. * Closes a collapseable box.
  671. *
  672. * @param boxObj Collapseable box
  673. * @param buttonObj Button controlling box
  674. */
  675. function closeBox(boxObj, buttonObj) {
  676. if (boxObj == null || buttonObj == null) {
  677. // Box or button not found
  678. } else {
  679. // Change 'display' CSS property of box
  680. boxObj.style.display="none";
  681. // Change text of button
  682. if (boxObj.style.display=="none") {
  683. buttonObj.value=" + ";
  684. }
  685. }
  686. }
  687. /**
  688. * Opens a collapseable box.
  689. *
  690. * @param boxObj Collapseable box
  691. * @param buttonObj Button controlling box
  692. */
  693. function openBox(boxObj, buttonObj) {
  694. if (boxObj == null || buttonObj == null) {
  695. // Box or button not found
  696. } else {
  697. // Change 'display' CSS property of box
  698. boxObj.style.display="block";
  699. // Change text of button
  700. if (boxObj.style.display=="block") {
  701. buttonObj.value=" - ";
  702. }
  703. }
  704. }
  705. /**
  706. * Sets the state of a collapseable box.
  707. *
  708. * @param boxID Identifier of box
  709. * @param open If true, box is "opened",
  710. * Otherwise, box is "closed".
  711. */
  712. function setState(boxID, open) {
  713. var boxObj = getElementObject(boxID);
  714. var buttonObj = getElementObject(boxID+B_SFIX);
  715. if (boxObj == null || buttonObj == null) {
  716. // Box or button not found
  717. } else if (open) {
  718. openBox(boxObj, buttonObj);
  719. // Make button visible
  720. buttonObj.style.display="inline";
  721. } else {
  722. closeBox(boxObj, buttonObj);
  723. // Make button visible
  724. buttonObj.style.display="inline";
  725. }
  726. }
  727. /**
  728. * Switches the state of a collapseable box, e.g.
  729. * if it's opened, it'll be closed, and vice versa.
  730. *
  731. * @param boxID Identifier of box
  732. */
  733. function switchState(boxID) {
  734. var boxObj = getElementObject(boxID);
  735. var buttonObj = getElementObject(boxID+B_SFIX);
  736. if (boxObj == null || buttonObj == null) {
  737. // Box or button not found
  738. } else if (boxObj.style.display=="none") {
  739. // Box is closed, so open it
  740. openBox(boxObj, buttonObj);
  741. } else if (boxObj.style.display=="block") {
  742. // Box is opened, so close it
  743. closeBox(boxObj, buttonObj);
  744. }
  745. }
  746. /**
  747. * Closes all boxes in a given list.
  748. *
  749. * @param boxList Array of box IDs
  750. */
  751. function collapseAll(boxList) {
  752. var idx;
  753. for (idx = 0; idx &lt; boxList.length; idx++) {
  754. var boxObj = getElementObject(boxList[idx]);
  755. var buttonObj = getElementObject(boxList[idx]+B_SFIX);
  756. closeBox(boxObj, buttonObj);
  757. }
  758. }
  759. /**
  760. * Open all boxes in a given list.
  761. *
  762. * @param boxList Array of box IDs
  763. */
  764. function expandAll(boxList) {
  765. var idx;
  766. for (idx = 0; idx &lt; boxList.length; idx++) {
  767. var boxObj = getElementObject(boxList[idx]);
  768. var buttonObj = getElementObject(boxList[idx]+B_SFIX);
  769. openBox(boxObj, buttonObj);
  770. }
  771. }
  772. /**
  773. * Makes all the control buttons of boxes appear.
  774. *
  775. * @param boxList Array of box IDs
  776. */
  777. function viewControlButtons(boxList) {
  778. var idx;
  779. for (idx = 0; idx &lt; boxList.length; idx++) {
  780. buttonObj = getElementObject(boxList[idx]+B_SFIX);
  781. if (buttonObj != null) {
  782. buttonObj.style.display = "inline";
  783. }
  784. }
  785. }
  786. /**
  787. * Makes all the control buttons of boxes disappear.
  788. *
  789. * @param boxList Array of box IDs
  790. */
  791. function hideControlButtons(boxList) {
  792. var idx;
  793. for (idx = 0; idx &lt; boxList.length; idx++) {
  794. buttonObj = getElementObject(boxList[idx]+B_SFIX);
  795. if (buttonObj != null) {
  796. buttonObj.style.display = "none";
  797. }
  798. }
  799. }
  800. /**
  801. * Sets the page for either printing mode
  802. * or viewing mode. In printing mode, the page
  803. * is made to be more readable when printing it out.
  804. * In viewing mode, the page is more browsable.
  805. *
  806. * @param isPrinterVersion If true, display in
  807. * printing mode; otherwise,
  808. * in viewing mode
  809. */
  810. function displayMode(isPrinterVersion) {
  811. var obj;
  812. if (isPrinterVersion) {
  813. // Hide global control buttons
  814. obj = getElementObject("globalControls");
  815. if (obj != null) {
  816. obj.style.visibility = "hidden";
  817. }
  818. // Hide Legend
  819. obj = getElementObject("legend");
  820. if (obj != null) {
  821. obj.style.display = "none";
  822. }
  823. obj = getElementObject("legendTOC");
  824. if (obj != null) {
  825. obj.style.display = "none";
  826. }
  827. // Hide Glossary
  828. obj = getElementObject("glossary");
  829. if (obj != null) {
  830. obj.style.display = "none";
  831. }
  832. obj = getElementObject("glossaryTOC");
  833. if (obj != null) {
  834. obj.style.display = "none";
  835. }
  836. // Expand all XML Instance Representation tables
  837. expandAll(xiBoxes);
  838. // Expand all Schema Component Representation tables
  839. expandAll(scBoxes);
  840. // Hide Control buttons
  841. hideControlButtons(xiBoxes);
  842. hideControlButtons(scBoxes);
  843. } else {
  844. // View global control buttons
  845. obj = getElementObject("globalControls");
  846. if (obj != null) {
  847. obj.style.visibility = "visible";
  848. }
  849. // View Legend
  850. obj = getElementObject("legend");
  851. if (obj != null) {
  852. obj.style.display = "block";
  853. }
  854. obj = getElementObject("legendTOC");
  855. if (obj != null) {
  856. obj.style.display = "block";
  857. }
  858. // View Glossary
  859. obj = getElementObject("glossary");
  860. if (obj != null) {
  861. obj.style.display = "block";
  862. }
  863. obj = getElementObject("glossaryTOC");
  864. if (obj != null) {
  865. obj.style.display = "block";
  866. }
  867. // Expand all XML Instance Representation tables
  868. expandAll(xiBoxes);
  869. // Collapse all Schema Component Representation tables
  870. collapseAll(scBoxes);
  871. // View Control buttons
  872. viewControlButtons(xiBoxes);
  873. viewControlButtons(scBoxes);
  874. }
  875. }
  876. /**
  877. * Opens up a window displaying the documentation
  878. * of a schema component in the XML Instance
  879. * Representation table.
  880. *
  881. * @param compDesc Description of schema component
  882. * @param compName Name of schema component
  883. * @param docTextArray Array containing the paragraphs
  884. * of the new document
  885. */
  886. function viewDocumentation(compDesc, compName, docTextArray) {
  887. var width = 400;
  888. var height = 200;
  889. var locX = 100;
  890. var locY = 200;
  891. /* Generate content */
  892. var actualText = "&lt;html>";
  893. actualText += "&lt;head>&lt;title>";
  894. actualText += compDesc;
  895. if (compName != '') {
  896. actualText += ": " + compName;
  897. }
  898. actualText += "&lt;/title>&lt;/head>";
  899. actualText += "&lt;body bgcolor=\"#FFFFEE\">";
  900. // Title
  901. actualText += "&lt;p style=\"font-family: Arial, sans-serif; font-size: 12pt; font-weight: bold; letter-spacing:1px;\">";
  902. actualText += compDesc;
  903. if (compName != '') {
  904. actualText += ": &lt;span style=\"color:#006699\">" + compName + "&lt;/span>";
  905. }
  906. actualText += "&lt;/p>";
  907. // Documentation
  908. var idx;
  909. for (idx = 0; idx &lt; docTextArray.length; idx++) {
  910. actualText += "&lt;p style=\"font-family: Arial, sans-serif; font-size: 10pt;\">" + docTextArray[idx] + "&lt;/p>";
  911. }
  912. // Link to close window
  913. actualText += "&lt;a href=\"javascript:void(0)\" onclick=\"window.close();\" style=\"font-family: Arial, sans-serif; font-size: 8pt;\">Close&lt;/a>";
  914. actualText += "&lt;/body>&lt;/html>";
  915. /* Display window */
  916. windowCount++;
  917. var docWindow = window.open("", "documentation"+windowCount, "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable,alwaysRaised,dependent,titlebar=no,width="+width+",height="+height+",screenX="+locX+",left="+locX+",screenY="+locY+",top="+locY);
  918. docWindow.document.write(actualText);
  919. }
  920. </xsl:text>
  921. </xsl:template>
  922. <!--
  923. CSS properties for the entire HTML document.
  924. -->
  925. <xsl:template name="DocumentCSSStyles">
  926. <xsl:text>
  927. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  928. /* More-configurable styles */
  929. /******** General ********/
  930. /* Document body */
  931. body {
  932. color: Black;
  933. background-color: White;
  934. font-family: Arial, sans-serif;
  935. font-size: 10pt;
  936. }
  937. /* Horizontal rules */
  938. hr {
  939. color: black;
  940. }
  941. /* Document title */
  942. h1 {
  943. font-size: 18pt;
  944. letter-spacing: 2px;
  945. border-bottom: 1px #ccc solid;
  946. padding-top: 5px;
  947. padding-bottom: 5px;
  948. }
  949. /* Main section headers */
  950. h2 {
  951. font-size: 14pt;
  952. letter-spacing: 1px;
  953. }
  954. /* Sub-section headers */
  955. h3, h3 a, h3 span {
  956. font-size: 12pt;
  957. font-weight: bold;
  958. color: black;
  959. }
  960. /* Table displaying the properties of the schema components or the
  961. schema document itself */
  962. table.properties th, table.properties th a {
  963. color: black;
  964. background-color: #F99; /* Pink */
  965. }
  966. table.properties td {
  967. background-color: #eee; /* Gray */
  968. }
  969. /******** Table of Contents Section ********/
  970. /* Controls for switching between printing and viewing modes */
  971. div#printerControls {
  972. color: #963; /* Orange-brown */
  973. }
  974. /* Controls that can collapse or expand all XML Instance
  975. Representation and Schema Component Representation boxes */
  976. div#globalControls {
  977. border: 2px solid #999;
  978. }
  979. /******** Schema Document Properties Section ********/
  980. /* Table displaying the namespaces declared in the schema */
  981. table.namespaces th {
  982. background-color: #ccc;
  983. }
  984. table.namespaces td {
  985. background-color: #eee;
  986. }
  987. /* Target namespace of the schema */
  988. span.targetNS {
  989. color: #06C;
  990. font-weight: bold;
  991. }
  992. /******** Schema Components' Sections ********/
  993. /* Name of schema component */
  994. .name {
  995. color: #F93; /* Orange */
  996. }
  997. /* Hierarchy table */
  998. table.hierarchy {
  999. border: 2px solid #999; /* Gray */
  1000. }
  1001. /* XML Instance Representation table */
  1002. div.sample div.contents {
  1003. border: 2px dashed black;
  1004. }
  1005. /* Schema Component Representation table */
  1006. div.schemaComponent div.contents {
  1007. border: 2px black solid;
  1008. }
  1009. /******** Glossary Section ********/
  1010. /* Glossary Terms */
  1011. .glossaryTerm {
  1012. color: #036; /* Blue */
  1013. }
  1014. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1015. /* Printer-version styles */
  1016. @media print {
  1017. /* Ensures that controls are hidden when printing */
  1018. div#printerControls {
  1019. visibility: hidden;
  1020. }
  1021. div#globalControls {
  1022. visibility: hidden;
  1023. }
  1024. #legend {
  1025. display: none;
  1026. }
  1027. #legendTOC {
  1028. display: none;
  1029. }
  1030. #glossary {
  1031. display: none;
  1032. }
  1033. #glossaryTOC {
  1034. display: none;
  1035. }
  1036. }
  1037. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1038. /* Base styles */
  1039. /******** General ********/
  1040. /* Unordered lists */
  1041. ul {
  1042. margin-left: 1.5em;
  1043. margin-bottom: 0em;
  1044. }
  1045. /* Tables */
  1046. table {
  1047. margin-top: 10px;
  1048. margin-bottom: 10px;
  1049. margin-left: 2px;
  1050. margin-right: 2px;
  1051. }
  1052. table th, table td {
  1053. font-size: 10pt;
  1054. vertical-align: top;
  1055. padding-top: 3px;
  1056. padding-bottom: 3px;
  1057. padding-left: 10px;
  1058. padding-right: 10px;
  1059. }
  1060. table th {
  1061. font-weight: bold;
  1062. text-align: left;
  1063. }
  1064. /* Table displaying the properties of the schema components or the
  1065. schema document itself */
  1066. table.properties {
  1067. width: 90%;
  1068. }
  1069. table.properties th {
  1070. width: 30%;
  1071. }
  1072. /* Boxes that can make its content appear and disappear*/
  1073. div.box {
  1074. margin: 1em;
  1075. }
  1076. /* Box caption */
  1077. div.box span.caption {
  1078. font-weight: bold;
  1079. }
  1080. /* Button to open and close the box */
  1081. div.box input.control {
  1082. width: 1.4em;
  1083. height: 1.4em;
  1084. text-align: center;
  1085. vertical-align: middle;
  1086. font-size: 11pt;
  1087. }
  1088. /* Box contents */
  1089. div.box div.contents {
  1090. margin-top: 3px;
  1091. }
  1092. /******** Table of Contents Section ********/
  1093. /* Controls for switching between printing and viewing modes */
  1094. div#printerControls {
  1095. white-space: nowrap;
  1096. font-weight: bold;
  1097. padding: 5px;
  1098. margin: 5px;
  1099. }
  1100. /* Controls that can collapse or expand all XML Instance
  1101. Representation and Schema Component Representation boxes */
  1102. div#globalControls {
  1103. padding: 10px;
  1104. margin: 5px;
  1105. }
  1106. /******** Schema Document Properties Section ********/
  1107. /* Table displaying the namespaces declared in the schema */
  1108. table.namespaces th {
  1109. }
  1110. table.namespaces td {
  1111. }
  1112. /* Target namespace of the schema */
  1113. span.targetNS {
  1114. }
  1115. /******** Schema Components' Sections ********/
  1116. /* Name of schema component */
  1117. .name {
  1118. }
  1119. /* Hierarchy table */
  1120. table.hierarchy {
  1121. width: 90%;
  1122. }
  1123. table.hierarchy th {
  1124. font-weight: normal;
  1125. font-style: italic;
  1126. width: 20%;
  1127. }
  1128. table.hierarchy th, table.hierarchy td {
  1129. padding: 5px;
  1130. }
  1131. /* XML Instance Representation table */
  1132. div.sample {
  1133. width: 90%;
  1134. }
  1135. div.sample div.contents {
  1136. padding: 5px;
  1137. font-family: Courier New, sans-serif;
  1138. font-size: 10pt;
  1139. }
  1140. /* Normal elements and attributes */
  1141. div.sample div.contents, div.sample div.contents a {
  1142. color: black;
  1143. }
  1144. /* Group Headers */
  1145. div.sample div.contents .group, div.sample div.contents .group a {
  1146. color: #999; /* Light gray */
  1147. }
  1148. /* Type Information */
  1149. div.sample div.contents .type, div.sample div.contents .type a {
  1150. color: #999; /* Light gray */
  1151. }
  1152. /* Occurrence Information */
  1153. div.sample div.contents .occurs, div.sample div.contents .occurs a {
  1154. color: #999; /* Light gray */
  1155. }
  1156. /* Fixed values */
  1157. div.sample div.contents .fixed {
  1158. color: #063; /* Green */
  1159. font-weight: bold;
  1160. }
  1161. /* Simple type constraints */
  1162. div.sample div.contents .constraint, div.sample div.contents .constraint a {
  1163. color: #999; /* Light gray */
  1164. }
  1165. /* Elements and attributes inherited from base type */
  1166. div.sample div.contents .inherited, div.sample div.contents .inherited a {
  1167. color: #666; /* Dark gray */
  1168. }
  1169. /* Elements and attributes added to or changed from base type */
  1170. div.sample div.contents .newFields {
  1171. font-weight: bold;
  1172. }
  1173. /* Other type of information */
  1174. div.sample div.contents .other, div.sample div.contents .other a {
  1175. color: #369; /* Blue */
  1176. font-style: italic;
  1177. }
  1178. /* Link to open up window displaying documentation */
  1179. div.sample div.contents a.documentation {
  1180. text-decoration: none;
  1181. padding-left: 3px;
  1182. padding-right: 3px;
  1183. padding-top: 0px;
  1184. padding-bottom: 0px;
  1185. font-weight: bold;
  1186. font-size: 11pt;
  1187. background-color: #FFD;
  1188. color: #069;
  1189. }
  1190. /* Invert colors when hovering over link to open up window
  1191. displaying documentation */
  1192. div.sample div.contents a.documentation:hover {
  1193. color: #FFD;
  1194. background-color: #069;
  1195. }
  1196. /* Schema Component Representation table */
  1197. div.schemaComponent {
  1198. width: 90%;
  1199. }
  1200. div.schemaComponent div.contents {
  1201. font-family: Courier New, sans-serif;
  1202. font-size: 10pt;
  1203. padding: 5px;
  1204. }
  1205. /* Syntax characters */
  1206. div.schemaComponent div.contents {
  1207. color: #00f; /* blue */
  1208. }
  1209. /* Element and attribute tags */
  1210. div.schemaComponent div.contents .scTag {
  1211. color: #933; /* maroon */
  1212. }
  1213. /* Element and attribute content */
  1214. div.schemaComponent div.contents .scContent, div.schemaComponent div.contents .scContent a {
  1215. color: black;
  1216. font-weight: bold;
  1217. }
  1218. /* Comments */
  1219. div.schemaComponent div.contents .comment {
  1220. color: #999; /* Light gray */
  1221. }
  1222. /******** Legend Section ********/
  1223. div#legend table, div#legend div {
  1224. margin-bottom: 3px;
  1225. }
  1226. div#legend div.hint {
  1227. color: #999; /* Light gray */
  1228. width: 90%;
  1229. margin-left: 1em;
  1230. margin-bottom: 2em;
  1231. }
  1232. /******** Glossary Section ********/
  1233. /* Glossary Terms */
  1234. .glossaryTerm {
  1235. font-weight: bold;
  1236. }
  1237. /******** Footer ********/
  1238. .footer {
  1239. font-size: 8pt;
  1240. }
  1241. </xsl:text>
  1242. </xsl:template>
  1243. <!--
  1244. Print outs a legend describing the meaning of colors, bold items,
  1245. etc. in the top-level sections.
  1246. -->
  1247. <xsl:template name="Legend">
  1248. <!-- Header -->
  1249. <div style="float: left; width: 15em;">
  1250. <h3 style="margin-bottom: 0px;">Complex Type:</h3>
  1251. <div class="hint" style="margin-left: 0em;">Schema Component Type</div>
  1252. </div>
  1253. <div style="float: left; width: 15em;">
  1254. <h3 style="margin-bottom: 0px;"><span class="name">AusAddress</span></h3>
  1255. <div class="hint" style="margin-left: 0em;">Schema Component Name</div>
  1256. </div>
  1257. <!-- Hierarchy Table -->
  1258. <table class="hierarchy" style="clear : both">
  1259. <tr>
  1260. <xsl:choose>
  1261. <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">
  1262. <th>Super-types:</th>
  1263. <td>
  1264. <span class="type" style="color: #0000FF; text-decoration:underline;">Address</span>
  1265. <xsl:text> &lt; </xsl:text>
  1266. <span class="current">AusAddress</span>
  1267. <xsl:text> (by extension)</xsl:text>
  1268. </td>
  1269. </xsl:when>
  1270. <xsl:otherwise>
  1271. <th>Parent type:</th>
  1272. <td>
  1273. <span class="type" style="color: #0000FF; text-decoration:underline;">Address</span>
  1274. <xsl:text> (derivation method: extension)</xsl:text>
  1275. </td>
  1276. </xsl:otherwise>
  1277. </xsl:choose>
  1278. </tr>
  1279. <tr>
  1280. <xsl:choose>
  1281. <xsl:when test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
  1282. <th>Sub-types:</th>
  1283. <td>
  1284. <ul>
  1285. <li>
  1286. <span class="type" style="color: #0000FF; text-decoration:underline;">QLDAddress</span>
  1287. <xsl:text> (by restriction)</xsl:text>
  1288. </li>
  1289. </ul>
  1290. </td>
  1291. </xsl:when>
  1292. <xsl:otherwise>
  1293. <th>Direct sub-types:</th>
  1294. <td>
  1295. <ul>
  1296. <li>
  1297. <span class="type" style="color: #0000FF; text-decoration:underline;">QLDAddress</span>
  1298. <xsl:text> (by restriction)</xsl:text>
  1299. </li>
  1300. </ul>
  1301. </td>
  1302. </xsl:otherwise>
  1303. </xsl:choose>
  1304. </tr>
  1305. </table>
  1306. <div class="hint">If this schema component is a type definition, its type hierarchy is shown in a gray-bordered box.</div>
  1307. <!-- Properties Table -->
  1308. <table class="properties">
  1309. <tr>
  1310. <th>Name</th>
  1311. <td>AusAddress</td>
  1312. </tr>
  1313. <tr>
  1314. <th>
  1315. <a title="Look up 'Abstract' in glossary" href="#term_Abstract">Abstract</a>
  1316. </th>
  1317. <td>no</td>
  1318. </tr>
  1319. </table>
  1320. <div class="hint">The table above displays the properties of this schema component.</div>
  1321. <!-- XML Instance Representation Table -->
  1322. <div class="sample box">
  1323. <div>
  1324. <span class="caption">XML Instance Representation</span>
  1325. </div>
  1326. <div class="contents">
  1327. <span style="margin-left: 0em">&lt;...</span>
  1328. <span class="newFields">
  1329. <span> country="<span class="fixed">Australia</span>"</span>
  1330. </span>
  1331. <xsl:text>&gt; </xsl:text><br/>
  1332. <span style="margin-left: 1.5em" class="inherited">&lt;unitNo&gt; <span class="type">string</span> &lt;/unitNo&gt; <span class="occurs">[0..1]</span></span><br/>
  1333. <span style="margin-left: 1.5em" class="inherited">&lt;houseNo&gt; <span class="type">string</span> &lt;/houseNo&gt; <span class="occurs">[1]</span></span><br/>
  1334. <span style="margin-left: 1.5em" class="inherited">&lt;street&gt; <span class="type">string</span> &lt;/street&gt; <span class="occurs">[1]</span></span><br/>
  1335. <span class="group" style="margin-left: 1.5em">Start <a title="Look up 'Choice' in glossary" href="#term_Choice">Choice</a> <span class="occurs">[1]</span></span><br/>
  1336. <span style="margin-left: 3em" class="inherited">&lt;city&gt; <span class="type">string</span> &lt;/city&gt; <span class="occurs">[1]</span></span><br/>
  1337. <span style="margin-left: 3em" class="inherited">&lt;town&gt; <span class="type">string</span> &lt;/town&gt; <span class="occurs">[1]</span></span><br/>
  1338. <span class="group" style="margin-left: 1.5em">End Choice</span><br/>
  1339. <span class="newFields">
  1340. <span style="margin-left: 1.5em">&lt;state&gt; <span class="type" style="text-decoration:underline;">AusStates</span> &lt;/state&gt; <span class="occurs">[1]</span></span><br/>
  1341. <span style="margin-left: 1.5em">&lt;postcode&gt; <span class="constraint">string &lt;&lt;<em>pattern</em> = [1-9][0-9]{3}>></span> &lt;/postcode&gt; <span class="occurs">[1]</span>
  1342. <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
  1343. <a href="javascript:void(0)" title="View Documentation" class="documentation" onclick="docArray = new Array('Post code must be a four-digit number.'); viewDocumentation('Element', 'postcode', docArray);">?</a>
  1344. </xsl:if>
  1345. </span><br/>
  1346. </span>
  1347. <span style="margin-left: 0em">&lt;/...&gt;</span><br/>
  1348. </div>
  1349. </div>
  1350. <div class="hint">
  1351. <p>The XML Instance Representation table above shows the schema component's content as an XML instance.</p>
  1352. <ul>
  1353. <li>The minimum and maximum occurrence of elements and attributes are provided in square brackets, e.g. [0..1].</li>
  1354. <li>Model group information are shown in gray, e.g. Start Choice ... End Choice.</li>
  1355. <li>For type derivations, the elements and attributes that have been added to or changed from the base type's content are shown in <span style="font-weight: bold">bold</span>.</li>
  1356. <li>If an element/attribute has a fixed value, the fixed value is shown in green, e.g. country="Australia".</li>
  1357. <li>Otherwise, the type of the element/attribute is displayed.
  1358. <ul>
  1359. <li>If the element/attribute's type is in the schema, a link is provided to it.</li>
  1360. <!--<li>An <em>E</em> symbol is shown if the element/attribute's type is located in an external schema.</li>-->
  1361. <li>For local simple type definitions, the constraints are displayed in angle brackets, e.g. &lt;&lt;<em>pattern</em> = [1-9][0-9]{3}>>.</li>
  1362. </ul>
  1363. </li>
  1364. <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
  1365. <li>If a local element/attribute has documentation, it will be displayed in a window that pops up when the question mark inside the attribute or next to the element is clicked, e.g. &lt;postcode>.</li>
  1366. </xsl:if>
  1367. </ul>
  1368. </div>
  1369. <!-- Schema Component Representation Table -->
  1370. <div class="schemaComponent box">
  1371. <div>
  1372. <span class="caption">Schema Component Representation</span>
  1373. </div>
  1374. <div class="contents">
  1375. <span style="margin-left: 0em">&lt;<span class="scTag">complexType</span> <span class="scTag">name</span>="<span class="scContent">AusAddress</span>"&gt;</span><br/>
  1376. <span style="margin-left: 1.5em">&lt;<span class="scTag">complexContent</span>&gt;</span><br/>
  1377. <span style="margin-left: 3em">&lt;<span class="scTag">extension</span> <span class="scTag">base</span>="<span class="scContent"><span class="type" style="text-decoration:underline;">Address</span></span>"&gt;</span><br/>
  1378. <span style="margin-left: 4.5em">&lt;<span class="scTag">sequence</span>&gt;</span><br/>
  1379. <span style="margin-left: 6em">&lt;<span class="scTag">element</span> <span class="scTag">name</span>="<span class="scContent">state</span>" <span class="scTag">type</span>="<span class="scContent"><span class="type" style="text-decoration:underline;">AusStates</span></span>"/&gt;</span><br/>
  1380. <span style="margin-left: 6em">&lt;<span class="scTag">element</span> <span class="scTag">name</span>="<span class="scContent">postcode</span>"&gt;</span><br/>
  1381. <span style="margin-left: 7.5em">&lt;<span class="scTag">simpleType</span>&gt;</span><br/>
  1382. <span style="margin-left: 9em">&lt;<span class="scTag">restriction</span> <span class="scTag">base</span>="<span class="scContent"><span class="type">string</span></span>"&gt;</span><br/>
  1383. <span style="margin-left: 10.5em">&lt;<span class="scTag">pattern</span> <span class="scTag">value</span>="<span class="scContent">[1-9][0-9]{3}</span>"/&gt;</span><br/>
  1384. <span style="margin-left: 9em">&lt;/<span class="scTag">restriction</span>&gt;</span><br/>
  1385. <span style="margin-left: 7.5em">&lt;/<span class="scTag">simpleType</span>&gt;</span><br/>
  1386. <span style="margin-left: 6em">&lt;/<span class="scTag">element</span>&gt;</span><br/>
  1387. <span style="margin-left: 4.5em">&lt;/<span class="scTag">sequence</span>&gt;</span><br/>
  1388. <span style="margin-left: 4.5em">&lt;<span class="scTag">attribute</span> <span class="scTag">name</span>="<span class="scContent">country</span>" <span class="scTag">type</span>="<span class="scContent"><span class="type">string</span></span>" <span class="scTag">fixed</span>="<span class="scContent">Australia</span>"/&gt;</span><br/>
  1389. <span style="margin-left: 3em">&lt;/<span class="scTag">extension</span>&gt;</span><br/>
  1390. <span style="margin-left: 1.5em">&lt;/<span class="scTag">complexContent</span>&gt;</span><br/>
  1391. <span style="margin-left: 0em">&lt;/<span class="scTag">complexType</span>&gt;</span><br/>
  1392. </div>
  1393. </div>
  1394. <div class="hint">The Schema Component Representation table above displays the underlying XML representation of the schema component. (Annotations are not shown.)</div>
  1395. </xsl:template>
  1396. <!--
  1397. Print outs all terms for the glossary section.
  1398. -->
  1399. <xsl:template name="Glossary">
  1400. <xsl:call-template name="PrintGlossaryTerm">
  1401. <xsl:with-param name="code">Abstract</xsl:with-param>
  1402. <xsl:with-param name="term">Abstract</xsl:with-param>
  1403. <xsl:with-param name="description">
  1404. <xsl:text>(Applies to complex type definitions and element declarations).</xsl:text>
  1405. <xsl:text> An abstract element or complex type cannot used to validate an element instance.</xsl:text>
  1406. <xsl:text> If there is a reference to an abstract element, only element declarations that can substitute the abstract element can be used to validate the instance.</xsl:text>
  1407. <xsl:text> For references to abstract type definitions, only derived types can be used.</xsl:text>
  1408. </xsl:with-param>
  1409. </xsl:call-template>
  1410. <xsl:call-template name="PrintGlossaryTerm">
  1411. <xsl:with-param name="code">All</xsl:with-param>
  1412. <xsl:with-param name="term">All Model Group</xsl:with-param>
  1413. <xsl:with-param name="description">
  1414. <xsl:text>Child elements can be provided </xsl:text>
  1415. <em>
  1416. <xsl:text>in any order</xsl:text>
  1417. </em>
  1418. <xsl:text> in instances.</xsl:text>
  1419. </xsl:with-param>
  1420. <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-all</xsl:with-param>
  1421. </xsl:call-template>
  1422. <xsl:call-template name="PrintGlossaryTerm">
  1423. <xsl:with-param name="code">Choice</xsl:with-param>
  1424. <xsl:with-param name="term">Choice Model Group</xsl:with-param>
  1425. <xsl:with-param name="description">
  1426. <em>
  1427. <xsl:text>Only one</xsl:text>
  1428. </em>
  1429. <xsl:text> from the list of child elements and model groups can be provided in instances.</xsl:text>
  1430. </xsl:with-param>
  1431. <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-choice</xsl:with-param>
  1432. </xsl:call-template>
  1433. <xsl:call-template name="PrintGlossaryTerm">
  1434. <xsl:with-param name="code">CollapseWS</xsl:with-param>
  1435. <xsl:with-param name="term">Collapse Whitespace Policy</xsl:with-param>
  1436. <xsl:with-param name="description">Replace tab, line feed, and carriage return characters with space character (Unicode character 32). Then, collapse contiguous sequences of space characters into single space character, and remove leading and trailing space characters.</xsl:with-param>
  1437. </xsl:call-template>
  1438. <xsl:call-template name="PrintGlossaryTerm">
  1439. <xsl:with-param name="code">ElemBlock</xsl:with-param>
  1440. <xsl:with-param name="term">Disallowed Substitutions</xsl:with-param>
  1441. <xsl:with-param name="description">
  1442. <xsl:text>(Applies to element declarations).</xsl:text>
  1443. <xsl:text> If </xsl:text>
  1444. <em>substitution</em>
  1445. <xsl:text> is specified, then </xsl:text>
  1446. <xsl:call-template name="PrintGlossaryTermRef">
  1447. <xsl:with-param name="code">SubGroup</xsl:with-param>
  1448. <xsl:with-param name="term">substitution group</xsl:with-param>
  1449. </xsl:call-template>
  1450. <xsl:text> members cannot be used in place of the given element declaration to validate element instances.</xsl:text>
  1451. <xsl:text> If </xsl:text>
  1452. <em>derivation methods</em>
  1453. <xsl:text>, e.g. extension, restriction, are specified, then the given element declaration will not validate element instances that have types derived from the element declaration's type using the specified derivation methods.</xsl:text>
  1454. <xsl:text> Normally, element instances can override their declaration's type by specifying an </xsl:text>
  1455. <code>xsi:type</code>
  1456. <xsl:text> attribute.</xsl:text>
  1457. </xsl:with-param>
  1458. </xsl:call-template>
  1459. <xsl:call-template name="PrintGlossaryTerm">
  1460. <xsl:with-param name="code">Key</xsl:with-param>
  1461. <xsl:with-param name="term">Key Constraint</xsl:with-param>
  1462. <xsl:with-param name="description">
  1463. <xsl:text>Like </xsl:text>
  1464. <xsl:call-template name="PrintGlossaryTermRef">
  1465. <xsl:with-param name="code">Unique</xsl:with-param>
  1466. <xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>
  1467. </xsl:call-template>
  1468. <xsl:text>, but additionally requires that the specified value(s) must be provided.</xsl:text>
  1469. </xsl:with-param>
  1470. <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>
  1471. </xsl:call-template>
  1472. <xsl:call-template name="PrintGlossaryTerm">
  1473. <xsl:with-param name="code">KeyRef</xsl:with-param>
  1474. <xsl:with-param name="term">Key Reference Constraint</xsl:with-param>
  1475. <xsl:with-param name="description">
  1476. <xsl:text>Ensures that the specified value(s) must match value(s) from a </xsl:text>
  1477. <xsl:call-template name="PrintGlossaryTermRef">
  1478. <xsl:with-param name="code">Key</xsl:with-param>
  1479. <xsl:with-param name="term">Key Constraint</xsl:with-param>
  1480. </xsl:call-template>
  1481. <xsl:text> or </xsl:text>
  1482. <xsl:call-template name="PrintGlossaryTermRef">
  1483. <xsl:with-param name="code">Unique</xsl:with-param>
  1484. <xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>
  1485. </xsl:call-template>
  1486. <xsl:text>.</xsl:text>
  1487. </xsl:with-param>
  1488. <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>
  1489. </xsl:call-template>
  1490. <xsl:call-template name="PrintGlossaryTerm">
  1491. <xsl:with-param name="code">ModelGroup</xsl:with-param>
  1492. <xsl:with-param name="term">Model Group</xsl:with-param>
  1493. <xsl:with-param name="description">
  1494. <xsl:text>Groups together element content, specifying the order in which the element content can occur and the number of times the group of element content may be repeated.</xsl:text>
  1495. </xsl:with-param>
  1496. <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#Model_Groups</xsl:with-param>
  1497. </xsl:call-template>
  1498. <xsl:call-template name="PrintGlossaryTerm">
  1499. <xsl:with-param name="code">Nillable</xsl:with-param>
  1500. <xsl:with-param name="term">Nillable</xsl:with-param>
  1501. <xsl:with-param name="description">
  1502. <xsl:text>(Applies to element declarations). </xsl:text>
  1503. <xsl:text>If an element declaration is nillable, instances can use the </xsl:text>
  1504. <code>xsi:nil</code>
  1505. <xsl:text> attribute.</xsl:text>
  1506. <xsl:text> The </xsl:text>
  1507. <code>xsi:nil</code>
  1508. <xsl:text> attribute is the boolean attribute, </xsl:text>
  1509. <em>nil</em>
  1510. <xsl:text>, from the </xsl:text>
  1511. <em>http://www.w3.org/2001/XMLSchema-instance</em>
  1512. <xsl:text> namespace.</xsl:text>
  1513. <xsl:text> If an element instance has an </xsl:text>
  1514. <code>xsi:nil</code>
  1515. <xsl:text> attribute set to true, it can be left empty, even though its element declaration may have required content.</xsl:text>
  1516. </xsl:with-param>
  1517. </xsl:call-template>
  1518. <xsl:call-template name="PrintGlossaryTerm">
  1519. <xsl:with-param name="code">Notation</xsl:with-param>
  1520. <xsl:with-param name="term">Notation</xsl:with-param>
  1521. <xsl:with-param name="description">A notation is used to identify the format of a piece of data. Values of elements and attributes that are of type, NOTATION, must come from the names of declared notations.</xsl:with-param>
  1522. <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cNotation_Declarations</xsl:with-param>
  1523. </xsl:call-template>
  1524. <xsl:call-template name="PrintGlossaryTerm">
  1525. <xsl:with-param name="code">PreserveWS</xsl:with-param>
  1526. <xsl:with-param name="term">Preserve Whitespace Policy</xsl:with-param>
  1527. <xsl:with-param name="description">Preserve whitespaces exactly as they appear in instances.</xsl:with-param>
  1528. </xsl:call-template>
  1529. <xsl:call-template name="PrintGlossaryTerm">
  1530. <xsl:with-param name="code">TypeFinal</xsl:with-param>
  1531. <xsl:with-param name="term">Prohibited Derivations</xsl:with-param>
  1532. <xsl:with-param name="description">
  1533. <xsl:text>(Applies to type definitions). </xsl:text>
  1534. <xsl:text>Derivation methods that cannot be used to create sub-types from a given type definition.</xsl:text>
  1535. </xsl:with-param>
  1536. </xsl:call-template>
  1537. <xsl:call-template name="PrintGlossaryTerm">
  1538. <xsl:with-param name="code">TypeBlock</xsl:with-param>
  1539. <xsl:with-param name="term">Prohibited Substitutions</xsl:with-param>
  1540. <xsl:with-param name="description">
  1541. <xsl:text>(Applies to complex type definitions). </xsl:text>
  1542. <xsl:text>Prevents sub-types that have been derived using the specified derivation methods from validating element instances in place of the given type definition.</xsl:text>
  1543. </xsl:with-param>
  1544. </xsl:call-template>
  1545. <xsl:call-template name="PrintGlossaryTerm">
  1546. <xsl:with-param name="code">ReplaceWS</xsl:with-param>
  1547. <xsl:with-param name="term">Replace Whitespace Policy</xsl:with-param>
  1548. <xsl:with-param name="description">Replace tab, line feed, and carriage return characters with space character (Unicode character 32).</xsl:with-param>
  1549. </xsl:call-template>
  1550. <xsl:call-template name="PrintGlossaryTerm">
  1551. <xsl:with-param name="code">Sequence</xsl:with-param>
  1552. <xsl:with-param name="term">Sequence Model Group</xsl:with-param>
  1553. <xsl:with-param name="description">
  1554. <xsl:text>Child elements and model groups must be provided </xsl:text>
  1555. <em>
  1556. <xsl:text>in the specified order</xsl:text>
  1557. </em>
  1558. <xsl:text> in instances.</xsl:text>
  1559. </xsl:with-param>
  1560. <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#element-sequence</xsl:with-param>
  1561. </xsl:call-template>
  1562. <xsl:call-template name="PrintGlossaryTerm">
  1563. <xsl:with-param name="code">SubGroup</xsl:with-param>
  1564. <xsl:with-param name="term">Substitution Group</xsl:with-param>
  1565. <xsl:with-param name="description">
  1566. <xsl:text>Elements that are </xsl:text>
  1567. <em>
  1568. <xsl:text>members</xsl:text>
  1569. </em>
  1570. <xsl:text> of a substitution group can be used wherever the </xsl:text>
  1571. <em>
  1572. <xsl:text>head</xsl:text>
  1573. </em>
  1574. <xsl:text> element of the substitution group is referenced.</xsl:text>
  1575. </xsl:with-param>
  1576. </xsl:call-template>
  1577. <xsl:call-template name="PrintGlossaryTerm">
  1578. <xsl:with-param name="code">ElemFinal</xsl:with-param>
  1579. <xsl:with-param name="term">Substitution Group Exclusions</xsl:with-param>
  1580. <xsl:with-param name="description">
  1581. <xsl:text>(Applies to element declarations). </xsl:text>
  1582. <xsl:text>Prohibits element declarations from nominating themselves as being able to substitute a given element declaration, if they have types that are derived from the original element's type using the specified derivation methods.</xsl:text>
  1583. </xsl:with-param>
  1584. </xsl:call-template>
  1585. <xsl:call-template name="PrintGlossaryTerm">
  1586. <xsl:with-param name="code">TargetNS</xsl:with-param>
  1587. <xsl:with-param name="term">Target Namespace</xsl:with-param>
  1588. <xsl:with-param name="description">The target namespace identifies the namespace that components in this schema belongs to. If no target namespace is provided, then the schema components do not belong to any namespace.</xsl:with-param>
  1589. </xsl:call-template>
  1590. <xsl:call-template name="PrintGlossaryTerm">
  1591. <xsl:with-param name="code">Unique</xsl:with-param>
  1592. <xsl:with-param name="term">Uniqueness Constraint</xsl:with-param>
  1593. <xsl:with-param name="description">Ensures uniqueness of an element/attribute value, or a combination of values, within a specified scope.</xsl:with-param>
  1594. <xsl:with-param name="link">http://www.w3.org/TR/xmlschema-1/#cIdentity-constraint_Definitions</xsl:with-param>
  1595. </xsl:call-template>
  1596. </xsl:template>
  1597. <!--
  1598. Prints out a term in the glossary section.
  1599. Param(s):
  1600. code (String) required
  1601. Unique ID of glossary term
  1602. term (String) required
  1603. Glossary term
  1604. description (Result Tree Fragment) required
  1605. Meaning of term; may contain HTML tags and links
  1606. link (String) optional
  1607. URI containing more info about term
  1608. -->
  1609. <xsl:template name="PrintGlossaryTerm">
  1610. <xsl:param name="code"/>
  1611. <xsl:param name="term"/>
  1612. <xsl:param name="description"/>
  1613. <xsl:param name="link"/>
  1614. <p>
  1615. <span class="glossaryTerm">
  1616. <a name="{concat($TERM_PREFIX, $code)}"><xsl:value-of select="$term"/></a>
  1617. <xsl:text> </xsl:text>
  1618. </span>
  1619. <xsl:copy-of select="$description"/>
  1620. <xsl:if test="$link != ''">
  1621. <xsl:text> See: </xsl:text>
  1622. <xsl:call-template name="PrintURI">
  1623. <xsl:with-param name="uri" select="$link"/>
  1624. </xsl:call-template>
  1625. <xsl:text>.</xsl:text>
  1626. </xsl:if>
  1627. </p>
  1628. </xsl:template>
  1629. <!-- ******** Hierarchy table ******** -->
  1630. <!--
  1631. Prints out substitution group hierarchy for
  1632. element declarations.
  1633. -->
  1634. <xsl:template match="xsd:element" mode="hierarchy">
  1635. <!--
  1636. Find out members of substitution group that this element
  1637. heads.
  1638. -->
  1639. <xsl:variable name="members">
  1640. <ul>
  1641. <xsl:call-template name="PrintSGroupMembers">
  1642. <xsl:with-param name="element" select="."/>
  1643. </xsl:call-template>
  1644. </ul>
  1645. </xsl:variable>
  1646. <xsl:variable name="hasMembers">
  1647. <xsl:if test="normalize-space($members)!=''">
  1648. <xsl:text>true</xsl:text>
  1649. </xsl:if>
  1650. </xsl:variable>
  1651. <!-- Print hierarchy table -->
  1652. <xsl:if test="@substitutionGroup or normalize-space($hasMembers)='true'">
  1653. <table class="hierarchy">
  1654. <tr>
  1655. <td>
  1656. <ul>
  1657. <!-- Print substitution group that this element belongs to -->
  1658. <xsl:if test="@substitutionGroup">
  1659. <li>
  1660. <em>This element can be used wherever the following element is referenced:</em>
  1661. <ul>
  1662. <li>
  1663. <xsl:call-template name="PrintElementRef">
  1664. <xsl:with-param name="ref" select="@substitutionGroup"/>
  1665. </xsl:call-template>
  1666. </li>
  1667. </ul>
  1668. </li>
  1669. </xsl:if>
  1670. <!-- Print substitution group that this element heads -->
  1671. <xsl:if test="normalize-space($hasMembers)='true'">
  1672. <li>
  1673. <em>The following elements can be used wherever this element is referenced:</em>
  1674. <xsl:copy-of select="$members"/>
  1675. </li>
  1676. </xsl:if>
  1677. </ul>
  1678. </td>
  1679. </tr>
  1680. </table>
  1681. </xsl:if>
  1682. </xsl:template>
  1683. <!--
  1684. Prints out Hierarchy table for complex type definitions.
  1685. -->
  1686. <xsl:template match="xsd:complexType" mode="hierarchy">
  1687. <table class="hierarchy">
  1688. <!-- Print super types -->
  1689. <tr>
  1690. <th>
  1691. <xsl:choose>
  1692. <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">
  1693. <xsl:text>Super-types:</xsl:text>
  1694. </xsl:when>
  1695. <xsl:otherwise>
  1696. <xsl:text>Parent type:</xsl:text>
  1697. </xsl:otherwise>
  1698. </xsl:choose>
  1699. </th>
  1700. <td>
  1701. <xsl:choose>
  1702. <xsl:when test="xsd:simpleContent or xsd:complexContent">
  1703. <xsl:call-template name="PrintSupertypes">
  1704. <xsl:with-param name="type" select="."/>
  1705. </xsl:call-template>
  1706. </xsl:when>
  1707. <xsl:otherwise>
  1708. <xsl:text>None</xsl:text>
  1709. </xsl:otherwise>
  1710. </xsl:choose>
  1711. </td>
  1712. </tr>
  1713. <!-- Print sub types -->
  1714. <tr>
  1715. <th>
  1716. <xsl:choose>
  1717. <xsl:when test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
  1718. <xsl:text>Sub-types:</xsl:text>
  1719. </xsl:when>
  1720. <xsl:otherwise>
  1721. <xsl:text>Direct sub-types:</xsl:text>
  1722. </xsl:otherwise>
  1723. </xsl:choose>
  1724. </th>
  1725. <td>
  1726. <xsl:call-template name="PrintComplexSubtypes">
  1727. <xsl:with-param name="type" select="."/>
  1728. </xsl:call-template>
  1729. </td>
  1730. </tr>
  1731. </table>
  1732. </xsl:template>
  1733. <!--
  1734. Prints out Hierarchy table for simple type definitions.
  1735. -->
  1736. <xsl:template match="xsd:simpleType" mode="hierarchy">
  1737. <table class="hierarchy">
  1738. <!-- Print super types -->
  1739. <tr>
  1740. <th>
  1741. <xsl:choose>
  1742. <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">
  1743. <xsl:text>Super-types:</xsl:text>
  1744. </xsl:when>
  1745. <xsl:otherwise>
  1746. <xsl:text>Parent type:</xsl:text>
  1747. </xsl:otherwise>
  1748. </xsl:choose>
  1749. </th>
  1750. <td>
  1751. <xsl:choose>
  1752. <xsl:when test="xsd:restriction">
  1753. <xsl:call-template name="PrintSupertypes">
  1754. <xsl:with-param name="type" select="."/>
  1755. </xsl:call-template>
  1756. </xsl:when>
  1757. <xsl:otherwise>
  1758. <xsl:text>None</xsl:text>
  1759. </xsl:otherwise>
  1760. </xsl:choose>
  1761. </td>
  1762. </tr>
  1763. <!-- Print sub types -->
  1764. <tr>
  1765. <th>
  1766. <xsl:choose>
  1767. <xsl:when test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
  1768. <xsl:text>Sub-types:</xsl:text>
  1769. </xsl:when>
  1770. <xsl:otherwise>
  1771. <xsl:text>Direct sub-types:</xsl:text>
  1772. </xsl:otherwise>
  1773. </xsl:choose>
  1774. </th>
  1775. <td>
  1776. <xsl:call-template name="PrintSimpleSubtypes">
  1777. <xsl:with-param name="type" select="."/>
  1778. </xsl:call-template>
  1779. </td>
  1780. </tr>
  1781. </table>
  1782. </xsl:template>
  1783. <!--
  1784. Unmatched template for 'hierarchy' mode
  1785. -->
  1786. <xsl:template match="*" mode="hierarchy"/>
  1787. <!--
  1788. Prints out members, if any, of the substitution group that a
  1789. given element declaration heads.
  1790. Assumes it will be called within XHTML <ul> tags.
  1791. Param(s):
  1792. element (Node) required
  1793. Top-level element declaration
  1794. elementList (String) optional
  1795. List of elements in this call chain. Name of element starts
  1796. with '*', and ends with '+'. (Used to prevent infinite
  1797. recursive loop.)
  1798. -->
  1799. <xsl:template name="PrintSGroupMembers">
  1800. <xsl:param name="element"/>
  1801. <xsl:param name="elementList"/>
  1802. <xsl:variable name="elemName" select="normalize-space($element/@name)"/>
  1803. <xsl:choose>
  1804. <xsl:when test="contains($elementList, concat('*', $elemName, '+'))">
  1805. <!-- Circular element substitution group hierarchy -->
  1806. <li>
  1807. <xsl:call-template name="HandleError">
  1808. <xsl:with-param name="isTerminating">false</xsl:with-param>
  1809. <xsl:with-param name="errorMsg">
  1810. <xsl:text>Circular element reference to: </xsl:text>
  1811. <xsl:value-of select="$elemName"/>
  1812. </xsl:with-param>
  1813. </xsl:call-template>
  1814. </li>
  1815. </xsl:when>
  1816. <xsl:otherwise>
  1817. <!-- Get 'block' attribute. -->
  1818. <xsl:variable name="block">
  1819. <xsl:call-template name="PrintBlockSet">
  1820. <xsl:with-param name="EBV">
  1821. <xsl:choose>
  1822. <xsl:when test="$element/@block">
  1823. <xsl:value-of select="$element/@block"/>
  1824. </xsl:when>
  1825. <xsl:otherwise>
  1826. <xsl:value-of select="/xsd:schema/@blockDefault"/>
  1827. </xsl:otherwise>
  1828. </xsl:choose>
  1829. </xsl:with-param>
  1830. </xsl:call-template>
  1831. </xsl:variable>
  1832. <xsl:for-each select="/xsd:schema/xsd:element[normalize-space(@substitutionGroup)=$elemName or normalize-space(substring-after(@substitutionGroup, ':'))=$elemName]">
  1833. <li>
  1834. <xsl:call-template name="PrintElementRef">
  1835. <xsl:with-param name="name" select="@name"/>
  1836. </xsl:call-template>
  1837. </li>
  1838. <!-- Recursively find members of a substitution group that
  1839. current element in list might head, since substitution
  1840. groups are transitive (unless 'substitution' is
  1841. blocked).
  1842. -->
  1843. <xsl:if test="not(contains($block, 'substitution'))">
  1844. <xsl:call-template name="PrintSGroupMembers">
  1845. <xsl:with-param name="element" select="."/>
  1846. <xsl:with-param name="elementList" select="concat($elementList, '*', $elemName, '+')"/>
  1847. </xsl:call-template>
  1848. </xsl:if>
  1849. </xsl:for-each>
  1850. </xsl:otherwise>
  1851. </xsl:choose>
  1852. </xsl:template>
  1853. <!--
  1854. Prints out the super types of a given type definition.
  1855. Param(s):
  1856. type (Node) required
  1857. Type definition
  1858. isCallingType (boolean) optional
  1859. If true, 'type' is the type definition that starts
  1860. this call. Otherwise, this is a recursive call from
  1861. 'PrintSupertypes' itself.
  1862. typeList (String) optional
  1863. List of types in this call chain. Name of type starts
  1864. with '*', and ends with '+'. (Used to prevent infinite
  1865. recursive loop.)
  1866. -->
  1867. <xsl:template name="PrintSupertypes">
  1868. <xsl:param name="type"/>
  1869. <xsl:param name="isCallingType">true</xsl:param>
  1870. <xsl:param name="typeList"/>
  1871. <xsl:variable name="typeName" select="$type/@name"/>
  1872. <xsl:choose>
  1873. <!-- Circular type hierarchy -->
  1874. <xsl:when test="contains($typeList, concat('*', $typeName, '+'))">
  1875. <!-- Note: Error message will be written out in the Sample Instance table. -->
  1876. <xsl:value-of select="$typeName"/>
  1877. </xsl:when>
  1878. <xsl:otherwise>
  1879. <!-- Get base type reference -->
  1880. <xsl:variable name="baseTypeRef">
  1881. <xsl:choose>
  1882. <!-- Complex type definition -->
  1883. <xsl:when test="local-name($type)='complexType'">
  1884. <xsl:choose>
  1885. <xsl:when test="$type/xsd:simpleContent/xsd:extension">
  1886. <xsl:value-of select="$type/xsd:simpleContent/xsd:extension/@base"/>
  1887. </xsl:when>
  1888. <xsl:when test="$type/xsd:simpleContent/xsd:restriction">
  1889. <xsl:value-of select="$type/xsd:simpleContent/xsd:restriction/@base"/>
  1890. </xsl:when>
  1891. <xsl:when test="$type/xsd:complexContent/xsd:extension">
  1892. <xsl:value-of select="$type/xsd:complexContent/xsd:extension/@base"/>
  1893. </xsl:when>
  1894. <xsl:when test="$type/xsd:complexContent/xsd:restriction">
  1895. <xsl:value-of select="$type/xsd:complexContent/xsd:restriction/@base"/>
  1896. </xsl:when>
  1897. </xsl:choose>
  1898. </xsl:when>
  1899. <!-- Simple type definition -->
  1900. <xsl:when test="local-name($type)='simpleType'">
  1901. <xsl:choose>
  1902. <xsl:when test="$type/xsd:restriction/@base">
  1903. <xsl:value-of select="$type/xsd:restriction/@base"/>
  1904. </xsl:when>
  1905. <xsl:when test="$type/xsd:restriction/xsd:simpleType">
  1906. <xsl:text>Local type definition</xsl:text>
  1907. </xsl:when>
  1908. </xsl:choose>
  1909. </xsl:when>
  1910. </xsl:choose>
  1911. </xsl:variable>
  1912. <!-- Get derivation method -->
  1913. <xsl:variable name="derive">
  1914. <!-- Complex type definition -->
  1915. <xsl:choose>
  1916. <xsl:when test="local-name($type)='complexType'">
  1917. <xsl:choose>
  1918. <xsl:when test="$type/xsd:simpleContent/xsd:extension or $type/xsd:complexContent/xsd:extension">
  1919. <xsl:text>extension</xsl:text>
  1920. </xsl:when>
  1921. <xsl:when test="$type/xsd:simpleContent/xsd:restriction or $type/xsd:complexContent/xsd:restriction">
  1922. <xsl:text>restriction</xsl:text>
  1923. </xsl:when>
  1924. </xsl:choose>
  1925. </xsl:when>
  1926. <!-- Simple type definition -->
  1927. <xsl:when test="local-name($type)='simpleType'">
  1928. <xsl:text>restriction</xsl:text>
  1929. </xsl:when>
  1930. </xsl:choose>
  1931. </xsl:variable>
  1932. <xsl:choose>
  1933. <!-- Print out entire hierarchy -->
  1934. <xsl:when test="normalize-space(translate($printAllSuperTypes, 'TRUE', 'true'))='true'">
  1935. <xsl:choose>
  1936. <xsl:when test="normalize-space($baseTypeRef)='Local type definition'">
  1937. <xsl:value-of select="$baseTypeRef"/>
  1938. <!-- Symbol to indicate type derivation-->
  1939. <xsl:text> &lt; </xsl:text>
  1940. </xsl:when>
  1941. <xsl:when test="normalize-space($baseTypeRef)!=''">
  1942. <!-- Get base type name from reference -->
  1943. <xsl:variable name="baseTypeName">
  1944. <xsl:call-template name="GetRefName">
  1945. <xsl:with-param name="ref" select="$baseTypeRef"/>
  1946. </xsl:call-template>
  1947. </xsl:variable>
  1948. <!-- Get base type definition from schema -->
  1949. <xsl:variable name="baseType" select="key('type', $baseTypeName)"/>
  1950. <xsl:choose>
  1951. <!-- Base type was found in this schema -->
  1952. <xsl:when test="$baseType">
  1953. <!-- Make recursive call to print out base type and itself -->
  1954. <xsl:call-template name="PrintSupertypes">
  1955. <xsl:with-param name="type" select="$baseType"/>
  1956. <xsl:with-param name="isCallingType">false</xsl:with-param>
  1957. <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>
  1958. </xsl:call-template>
  1959. </xsl:when>
  1960. <!-- Base type was not found in this schema -->
  1961. <xsl:otherwise>
  1962. <xsl:call-template name="PrintTypeRef">
  1963. <xsl:with-param name="ref" select="$baseTypeRef"/>
  1964. </xsl:call-template>
  1965. </xsl:otherwise>
  1966. </xsl:choose>
  1967. <!-- Symbol to indicate type derivation -->
  1968. <xsl:text> &lt; </xsl:text>
  1969. </xsl:when>
  1970. <xsl:otherwise>
  1971. <!-- IGNORE: Base type may not be exist probably because
  1972. current type does not be derived from another type.
  1973. -->
  1974. </xsl:otherwise>
  1975. </xsl:choose>
  1976. <!-- Print out current type's name -->
  1977. <xsl:choose>
  1978. <xsl:when test="$isCallingType='true'">
  1979. <strong><xsl:value-of select="$typeName"/></strong>
  1980. </xsl:when>
  1981. <xsl:otherwise>
  1982. <xsl:call-template name="PrintTypeRef">
  1983. <xsl:with-param name="name" select="$typeName"/>
  1984. </xsl:call-template>
  1985. </xsl:otherwise>
  1986. </xsl:choose>
  1987. <!-- Print out derivation method -->
  1988. <xsl:if test="$derive != ''">
  1989. <xsl:text> (by </xsl:text>
  1990. <xsl:value-of select="$derive"/>
  1991. <xsl:text>)</xsl:text>
  1992. </xsl:if>
  1993. </xsl:when>
  1994. <!-- Print out parent type only -->
  1995. <xsl:otherwise>
  1996. <!-- Print out base type reference -->
  1997. <xsl:choose>
  1998. <xsl:when test="normalize-space($baseTypeRef)='Local type definition'">
  1999. <xsl:value-of select="$baseTypeRef"/>
  2000. </xsl:when>
  2001. <xsl:when test="$baseTypeRef!=''">
  2002. <xsl:call-template name="PrintTypeRef">
  2003. <xsl:with-param name="ref" select="$baseTypeRef"/>
  2004. </xsl:call-template>
  2005. </xsl:when>
  2006. <xsl:otherwise>
  2007. <!-- IGNORE: Base type may not be exist probably because
  2008. current type does not be derived from another type.
  2009. -->
  2010. </xsl:otherwise>
  2011. </xsl:choose>
  2012. <!-- Print out derivation method -->
  2013. <xsl:if test="$derive != ''">
  2014. <xsl:text> (derivation method: </xsl:text>
  2015. <xsl:value-of select="$derive"/>
  2016. <xsl:text>)</xsl:text>
  2017. </xsl:if>
  2018. </xsl:otherwise>
  2019. </xsl:choose>
  2020. </xsl:otherwise>
  2021. </xsl:choose>
  2022. </xsl:template>
  2023. <!--
  2024. Prints out the sub types of a given complex type definition.
  2025. Param(s):
  2026. type (Node) required
  2027. Complex type definition
  2028. isCallingType (boolean) optional
  2029. If true, 'type' is the type definition that starts this
  2030. call. Otherwise, this is a recursive call from
  2031. 'PrintComplexSubtypes' itself.
  2032. typeList (String) optional
  2033. List of types in this call chain. Name of type starts
  2034. with '*', and ends with '+'. (Used to prevent infinite
  2035. recursive loop.)
  2036. -->
  2037. <xsl:template name="PrintComplexSubtypes">
  2038. <xsl:param name="type"/>
  2039. <xsl:param name="isCallingType">true</xsl:param>
  2040. <xsl:param name="typeList"/>
  2041. <xsl:variable name="typeName" select="normalize-space($type/@name)"/>
  2042. <xsl:choose>
  2043. <!-- Circular type hierarchy -->
  2044. <xsl:when test="contains($typeList, concat('*', $typeName, '+'))">
  2045. <!-- Do nothing. Note: Error message will be written out in the Sample Instance table. -->
  2046. </xsl:when>
  2047. <xsl:otherwise>
  2048. <!-- Find sub types -->
  2049. <xsl:variable name="subTypes">
  2050. <ul>
  2051. <xsl:for-each select="/xsd:schema/xsd:complexType/xsd:complexContent/xsd:restriction[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName] | /xsd:schema/xsd:complexType/xsd:complexContent/xsd:extension[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName]">
  2052. <li>
  2053. <xsl:variable name="subType" select="../.."/>
  2054. <!-- Write out type name -->
  2055. <xsl:call-template name="PrintTypeRef">
  2056. <xsl:with-param name="name" select="$subType/@name"/>
  2057. </xsl:call-template>
  2058. <!-- Write derivation method -->
  2059. <xsl:text> (by </xsl:text>
  2060. <xsl:value-of select="local-name(.)"/>
  2061. <xsl:text>)</xsl:text>
  2062. <!-- Make recursive call to write sub-types of this sub-type -->
  2063. <xsl:if test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
  2064. <xsl:call-template name="PrintComplexSubtypes">
  2065. <xsl:with-param name="type" select="$subType"/>
  2066. <xsl:with-param name="isCallingType">false</xsl:with-param>
  2067. <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>
  2068. </xsl:call-template>
  2069. </xsl:if>
  2070. </li>
  2071. </xsl:for-each>
  2072. </ul>
  2073. </xsl:variable>
  2074. <!-- Print out sub types -->
  2075. <xsl:choose>
  2076. <xsl:when test="normalize-space($subTypes)!=''">
  2077. <xsl:copy-of select="$subTypes"/>
  2078. </xsl:when>
  2079. <xsl:when test="$isCallingType='true'">
  2080. <xsl:text>None</xsl:text>
  2081. </xsl:when>
  2082. </xsl:choose>
  2083. </xsl:otherwise>
  2084. </xsl:choose>
  2085. </xsl:template>
  2086. <!--
  2087. Prints out the sub types of a given simple type definition.
  2088. Param(s):
  2089. type (Node) required
  2090. Simple type definition
  2091. isCallingType (boolean) optional
  2092. If true, 'type' is the type definition that starts this
  2093. call. Otherwise, this is a recursive call from
  2094. 'PrintSimpleSubtypes'
  2095. typeList (String) optional
  2096. List of types in this call chain. Name of type starts
  2097. with '*', and ends with '+'. (Used to prevent infinite
  2098. recursive loop.)
  2099. -->
  2100. <xsl:template name="PrintSimpleSubtypes">
  2101. <xsl:param name="type"/>
  2102. <xsl:param name="isCallingType">true</xsl:param>
  2103. <xsl:param name="typeList"/>
  2104. <xsl:variable name="typeName" select="normalize-space($type/@name)"/>
  2105. <xsl:choose>
  2106. <!-- Circular type hierarchy -->
  2107. <xsl:when test="contains($typeList, concat('*', $typeName, '+'))">
  2108. <!-- Do nothing. Note: Error message will be written out in the Sample Instance table. -->
  2109. </xsl:when>
  2110. <xsl:otherwise>
  2111. <!-- Find sub-types that are simple type definitions -->
  2112. <xsl:variable name="simpleSubTypes">
  2113. <ul>
  2114. <xsl:for-each select="/xsd:schema/xsd:simpleType/xsd:restriction[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName]">
  2115. <li>
  2116. <xsl:variable name="subType" select=".."/>
  2117. <!-- Write out type name -->
  2118. <xsl:call-template name="PrintTypeRef">
  2119. <xsl:with-param name="name" select="$subType/@name"/>
  2120. </xsl:call-template>
  2121. <!-- Write derivation method -->
  2122. <xsl:text> (by restriction)</xsl:text>
  2123. <!-- Make recursive call to write sub-types of this sub-type -->
  2124. <xsl:if test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
  2125. <xsl:call-template name="PrintSimpleSubtypes">
  2126. <xsl:with-param name="type" select="$subType"/>
  2127. <xsl:with-param name="isCallingType">false</xsl:with-param>
  2128. <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>
  2129. </xsl:call-template>
  2130. </xsl:if>
  2131. </li>
  2132. </xsl:for-each>
  2133. </ul>
  2134. </xsl:variable>
  2135. <!-- Find sub-types that are complex type definitions -->
  2136. <xsl:variable name="complexSubTypes">
  2137. <ul>
  2138. <xsl:for-each select="/xsd:schema/xsd:complexType/xsd:simpleContent/xsd:restriction[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName] | /xsd:schema/xsd:complexType/xsd:simpleContent/xsd:extension[normalize-space(@base)=$typeName or normalize-space(substring-after(@base, ':'))=$typeName]">
  2139. <li>
  2140. <xsl:variable name="subType" select="../.."/>
  2141. <!-- Write out type name -->
  2142. <xsl:call-template name="PrintTypeRef">
  2143. <xsl:with-param name="name" select="$subType/@name"/>
  2144. </xsl:call-template>
  2145. <!-- Write derivation method -->
  2146. <xsl:text> (by </xsl:text>
  2147. <xsl:value-of select="local-name(.)"/>
  2148. <xsl:text>)</xsl:text>
  2149. <!-- Make recursive call to write sub-types of this sub-type -->
  2150. <xsl:if test="normalize-space(translate($printAllSubTypes, 'TRUE', 'true'))='true'">
  2151. <xsl:call-template name="PrintComplexSubtypes">
  2152. <xsl:with-param name="type" select="$subType"/>
  2153. <xsl:with-param name="isCallingType">false</xsl:with-param>
  2154. <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>
  2155. </xsl:call-template>
  2156. </xsl:if>
  2157. </li>
  2158. </xsl:for-each>
  2159. </ul>
  2160. </xsl:variable>
  2161. <xsl:variable name="hasSimpleSubTypes">
  2162. <xsl:if test="normalize-space($simpleSubTypes)!=''">
  2163. <xsl:text>true</xsl:text>
  2164. </xsl:if>
  2165. </xsl:variable>
  2166. <xsl:variable name="hasComplexSubTypes">
  2167. <xsl:if test="normalize-space($complexSubTypes)!=''">
  2168. <xsl:text>true</xsl:text>
  2169. </xsl:if>
  2170. </xsl:variable>
  2171. <!-- Print out sub types -->
  2172. <xsl:choose>
  2173. <xsl:when test="$hasSimpleSubTypes='true' or $hasComplexSubTypes='true'">
  2174. <xsl:if test="$hasSimpleSubTypes='true'">
  2175. <xsl:copy-of select="$simpleSubTypes"/>
  2176. </xsl:if>
  2177. <xsl:if test="$hasComplexSubTypes='true'">
  2178. <xsl:copy-of select="$complexSubTypes"/>
  2179. </xsl:if>
  2180. </xsl:when>
  2181. <xsl:when test="$isCallingType='true'">
  2182. <xsl:text>None</xsl:text>
  2183. </xsl:when>
  2184. </xsl:choose>
  2185. </xsl:otherwise>
  2186. </xsl:choose>
  2187. </xsl:template>
  2188. <!-- ******** Properties table ******** -->
  2189. <!--
  2190. Prints out the contents of an 'appinfo' or a 'documentation'
  2191. element in the Properties table.
  2192. -->
  2193. <xsl:template match="xsd:appinfo | xsd:documentation" mode="properties">
  2194. <!-- Print out children using XML pretty printer templates -->
  2195. <xsl:choose>
  2196. <xsl:when test="local-name(.)='appinfo'">
  2197. <xsl:apply-templates select="* | text()" mode="xpp"/>
  2198. </xsl:when>
  2199. <xsl:otherwise>
  2200. <xsl:apply-templates select="* | text()" mode="html"/>
  2201. </xsl:otherwise>
  2202. </xsl:choose>
  2203. <!-- Print out URL in the source attribute. -->
  2204. <xsl:if test="@source">
  2205. <xsl:if test="* | text()"><br/></xsl:if>
  2206. <xsl:text> More information at: </xsl:text>
  2207. <xsl:call-template name="PrintURI">
  2208. <xsl:with-param name="uri" select="@source"/>
  2209. </xsl:call-template>
  2210. <xsl:text>.</xsl:text>
  2211. </xsl:if>
  2212. </xsl:template>
  2213. <!--
  2214. Prints out the Properties table for a top-level
  2215. attribute declaration.
  2216. -->
  2217. <xsl:template match="xsd:attribute" mode="properties">
  2218. <table class="properties">
  2219. <!-- Name -->
  2220. <tr>
  2221. <th>Name</th>
  2222. <td><xsl:value-of select="@name"/></td>
  2223. </tr>
  2224. <!-- Type -->
  2225. <tr>
  2226. <th>Type</th>
  2227. <td>
  2228. <xsl:choose>
  2229. <xsl:when test="xsd:simpleType">
  2230. <xsl:text>Locally-defined simple type</xsl:text>
  2231. </xsl:when>
  2232. <xsl:when test="@type">
  2233. <xsl:call-template name="PrintTypeRef">
  2234. <xsl:with-param name="ref" select="@type"/>
  2235. </xsl:call-template>
  2236. </xsl:when>
  2237. <xsl:otherwise>
  2238. <xsl:text>anySimpleType</xsl:text>
  2239. </xsl:otherwise>
  2240. </xsl:choose>
  2241. </td>
  2242. </tr>
  2243. <!-- Default Value -->
  2244. <xsl:if test="@default">
  2245. <tr>
  2246. <th>Default Value</th>
  2247. <td><xsl:value-of select="@default"/></td>
  2248. </tr>
  2249. </xsl:if>
  2250. <!-- Fixed Value -->
  2251. <xsl:if test="@fixed">
  2252. <tr>
  2253. <th>Fixed Value</th>
  2254. <td><xsl:value-of select="@fixed"/></td>
  2255. </tr>
  2256. </xsl:if>
  2257. <!-- Annotation -->
  2258. <xsl:call-template name="PrintAnnotation">
  2259. <xsl:with-param name="component" select="."/>
  2260. </xsl:call-template>
  2261. </table>
  2262. </xsl:template>
  2263. <!--
  2264. Prints out Properties table for a top-level
  2265. attribute group or model group definition.
  2266. -->
  2267. <xsl:template match="xsd:attributeGroup | xsd:group" mode="properties">
  2268. <table class="properties">
  2269. <!-- Name -->
  2270. <tr>
  2271. <th>Name</th>
  2272. <td><xsl:value-of select="@name"/></td>
  2273. </tr>
  2274. <!-- Annotation -->
  2275. <xsl:call-template name="PrintAnnotation">
  2276. <xsl:with-param name="component" select="."/>
  2277. </xsl:call-template>
  2278. </table>
  2279. </xsl:template>
  2280. <!--
  2281. Prints out the Properties table for a top-level
  2282. complex type definition.
  2283. -->
  2284. <xsl:template match="xsd:complexType" mode="properties">
  2285. <table class="properties">
  2286. <!-- Name -->
  2287. <tr>
  2288. <th>Name</th>
  2289. <td><xsl:value-of select="@name"/></td>
  2290. </tr>
  2291. <!-- Abstract -->
  2292. <tr>
  2293. <th>
  2294. <xsl:call-template name="PrintGlossaryTermRef">
  2295. <xsl:with-param name="code">Abstract</xsl:with-param>
  2296. <xsl:with-param name="term">Abstract</xsl:with-param>
  2297. </xsl:call-template>
  2298. </th>
  2299. <td>
  2300. <xsl:call-template name="PrintBoolean">
  2301. <xsl:with-param name="boolean" select="@abstract"/>
  2302. </xsl:call-template>
  2303. </td>
  2304. </tr>
  2305. <!-- Final -->
  2306. <xsl:variable name="final">
  2307. <xsl:call-template name="PrintDerivationSet">
  2308. <xsl:with-param name="EBV">
  2309. <xsl:choose>
  2310. <xsl:when test="@final">
  2311. <xsl:value-of select="@final"/>
  2312. </xsl:when>
  2313. <xsl:otherwise>
  2314. <xsl:value-of select="/xsd:schema/@finalDefault"/>
  2315. </xsl:otherwise>
  2316. </xsl:choose>
  2317. </xsl:with-param>
  2318. </xsl:call-template>
  2319. </xsl:variable>
  2320. <xsl:if test="normalize-space($final)!=''">
  2321. <tr>
  2322. <th>
  2323. <xsl:call-template name="PrintGlossaryTermRef">
  2324. <xsl:with-param name="code">TypeFinal</xsl:with-param>
  2325. <xsl:with-param name="term">Prohibited Derivations</xsl:with-param>
  2326. </xsl:call-template>
  2327. </th>
  2328. <td><xsl:value-of select="$final"/></td>
  2329. </tr>
  2330. </xsl:if>
  2331. <!-- Block -->
  2332. <xsl:variable name="block">
  2333. <xsl:call-template name="PrintDerivationSet">
  2334. <xsl:with-param name="EBV">
  2335. <xsl:choose>
  2336. <xsl:when test="@block">
  2337. <xsl:value-of select="@block"/>
  2338. </xsl:when>
  2339. <xsl:otherwise>
  2340. <xsl:value-of select="/xsd:schema/@blockDefault"/>
  2341. </xsl:otherwise>
  2342. </xsl:choose>
  2343. </xsl:with-param>
  2344. </xsl:call-template>
  2345. </xsl:variable>
  2346. <xsl:if test="normalize-space($block)!=''">
  2347. <tr>
  2348. <th>
  2349. <xsl:call-template name="PrintGlossaryTermRef">
  2350. <xsl:with-param name="code">TypeBlock</xsl:with-param>
  2351. <xsl:with-param name="term">Prohibited Substitutions</xsl:with-param>
  2352. </xsl:call-template>
  2353. </th>
  2354. <td><xsl:value-of select="$block"/></td>
  2355. </tr>
  2356. </xsl:if>
  2357. <!-- Annotation -->
  2358. <xsl:call-template name="PrintAnnotation">
  2359. <xsl:with-param name="component" select="."/>
  2360. </xsl:call-template>
  2361. </table>
  2362. </xsl:template>
  2363. <!--
  2364. Prints out the Properties table for a top-level
  2365. element declaration.
  2366. -->
  2367. <xsl:template match="xsd:element" mode="properties">
  2368. <table class="properties">
  2369. <!-- Name -->
  2370. <tr>
  2371. <th>Name</th>
  2372. <td><xsl:value-of select="@name"/></td>
  2373. </tr>
  2374. <!-- Type -->
  2375. <tr>
  2376. <th>Type</th>
  2377. <td>
  2378. <xsl:choose>
  2379. <xsl:when test="xsd:simpleType">
  2380. <xsl:text>Locally-defined simple type</xsl:text>
  2381. </xsl:when>
  2382. <xsl:when test="xsd:complexType">
  2383. <xsl:text>Locally-defined complex type</xsl:text>
  2384. </xsl:when>
  2385. <xsl:when test="@type">
  2386. <xsl:call-template name="PrintTypeRef">
  2387. <xsl:with-param name="ref" select="@type"/>
  2388. </xsl:call-template>
  2389. </xsl:when>
  2390. <xsl:otherwise>
  2391. <xsl:text>anyType</xsl:text>
  2392. </xsl:otherwise>
  2393. </xsl:choose>
  2394. </td>
  2395. </tr>
  2396. <!-- Nillable -->
  2397. <tr>
  2398. <th>
  2399. <xsl:call-template name="PrintGlossaryTermRef">
  2400. <xsl:with-param name="code">Nillable</xsl:with-param>
  2401. <xsl:with-param name="term">Nillable</xsl:with-param>
  2402. </xsl:call-template>
  2403. </th>
  2404. <td>
  2405. <xsl:call-template name="PrintBoolean">
  2406. <xsl:with-param name="boolean" select="@nillable"/>
  2407. </xsl:call-template>
  2408. </td>
  2409. </tr>
  2410. <!-- Abstract -->
  2411. <tr>
  2412. <th>
  2413. <xsl:call-template name="PrintGlossaryTermRef">
  2414. <xsl:with-param name="code">Abstract</xsl:with-param>
  2415. <xsl:with-param name="term">Abstract</xsl:with-param>
  2416. </xsl:call-template>
  2417. </th>
  2418. <td>
  2419. <xsl:call-template name="PrintBoolean">
  2420. <xsl:with-param name="boolean" select="@abstract"/>
  2421. </xsl:call-template>
  2422. </td>
  2423. </tr>
  2424. <!-- Default Value -->
  2425. <xsl:if test="@default">
  2426. <tr>
  2427. <th>Default Value</th>
  2428. <td><xsl:value-of select="@default"/></td>
  2429. </tr>
  2430. </xsl:if>
  2431. <!-- Fixed Value -->
  2432. <xsl:if test="@fixed">
  2433. <tr>
  2434. <th>Fixed Value</th>
  2435. <td><xsl:value-of select="@fixed"/></td>
  2436. </tr>
  2437. </xsl:if>
  2438. <!-- Final -->
  2439. <xsl:variable name="final">
  2440. <xsl:call-template name="PrintDerivationSet">
  2441. <xsl:with-param name="EBV">
  2442. <xsl:choose>
  2443. <xsl:when test="@final">
  2444. <xsl:value-of select="@final"/>
  2445. </xsl:when>
  2446. <xsl:otherwise>
  2447. <xsl:value-of select="/xsd:schema/@finalDefault"/>
  2448. </xsl:otherwise>
  2449. </xsl:choose>
  2450. </xsl:with-param>
  2451. </xsl:call-template>
  2452. </xsl:variable>
  2453. <xsl:if test="normalize-space($final)!=''">
  2454. <tr>
  2455. <th>
  2456. <xsl:call-template name="PrintGlossaryTermRef">
  2457. <xsl:with-param name="code">ElemFinal</xsl:with-param>
  2458. <xsl:with-param name="term">Substitution Group Exclusions</xsl:with-param>
  2459. </xsl:call-template>
  2460. </th>
  2461. <td><xsl:value-of select="$final"/></td>
  2462. </tr>
  2463. </xsl:if>
  2464. <!-- Block -->
  2465. <xsl:variable name="block">
  2466. <xsl:call-template name="PrintBlockSet">
  2467. <xsl:with-param name="EBV">
  2468. <xsl:choose>
  2469. <xsl:when test="@block">
  2470. <xsl:value-of select="@block"/>
  2471. </xsl:when>
  2472. <xsl:otherwise>
  2473. <xsl:value-of select="/xsd:schema/@blockDefault"/>
  2474. </xsl:otherwise>
  2475. </xsl:choose>
  2476. </xsl:with-param>
  2477. </xsl:call-template>
  2478. </xsl:variable>
  2479. <xsl:if test="normalize-space($block)!=''">
  2480. <tr>
  2481. <th>
  2482. <xsl:call-template name="PrintGlossaryTermRef">
  2483. <xsl:with-param name="code">ElemBlock</xsl:with-param>
  2484. <xsl:with-param name="term">Disallowed Substitutions</xsl:with-param>
  2485. </xsl:call-template>
  2486. </th>
  2487. <td><xsl:value-of select="$block"/></td>
  2488. </tr>
  2489. </xsl:if>
  2490. <!-- Annotation -->
  2491. <xsl:call-template name="PrintAnnotation">
  2492. <xsl:with-param name="component" select="."/>
  2493. </xsl:call-template>
  2494. </table>
  2495. </xsl:template>
  2496. <!--
  2497. Prints out the Properties table for a top-level
  2498. notation declaration.
  2499. -->
  2500. <xsl:template match="xsd:notation" mode="properties">
  2501. <table class="properties">
  2502. <!-- Name -->
  2503. <tr>
  2504. <th>Name</th>
  2505. <td><xsl:value-of select="@name"/></td>
  2506. </tr>
  2507. <!-- Public Identifier -->
  2508. <tr>
  2509. <th>Public Identifier</th>
  2510. <td><xsl:value-of select="@public"/></td>
  2511. </tr>
  2512. <!-- System Identifier -->
  2513. <xsl:if test="@system">
  2514. <tr>
  2515. <th>System Identifier</th>
  2516. <td><xsl:value-of select="@system"/></td>
  2517. </tr>
  2518. </xsl:if>
  2519. <!-- Annotation -->
  2520. <xsl:call-template name="PrintAnnotation">
  2521. <xsl:with-param name="component" select="."/>
  2522. </xsl:call-template>
  2523. </table>
  2524. </xsl:template>
  2525. <!--
  2526. Prints out the Properties table for the root
  2527. schema element.
  2528. -->
  2529. <xsl:template match="xsd:schema" mode="properties">
  2530. <table class="properties">
  2531. <!-- Target Namespace -->
  2532. <tr>
  2533. <th>
  2534. <xsl:call-template name="PrintGlossaryTermRef">
  2535. <xsl:with-param name="code">TargetNS</xsl:with-param>
  2536. <xsl:with-param name="term">Target Namespace</xsl:with-param>
  2537. </xsl:call-template>
  2538. </th>
  2539. <td>
  2540. <xsl:choose>
  2541. <xsl:when test="@targetNamespace">
  2542. <span class="targetNS">
  2543. <xsl:value-of select="@targetNamespace"/>
  2544. </span>
  2545. </xsl:when>
  2546. <xsl:otherwise>
  2547. <xsl:text>None</xsl:text>
  2548. </xsl:otherwise>
  2549. </xsl:choose>
  2550. </td>
  2551. </tr>
  2552. <!-- Version -->
  2553. <xsl:if test="@version">
  2554. <tr>
  2555. <th>Version</th>
  2556. <td><xsl:value-of select="@version"/></td>
  2557. </tr>
  2558. </xsl:if>
  2559. <!-- Language -->
  2560. <xsl:if test="@xml:lang">
  2561. <tr>
  2562. <th>Language</th>
  2563. <td><xsl:value-of select="@xml:lang"/></td>
  2564. </tr>
  2565. </xsl:if>
  2566. <!-- Element/Attribute Form Defaults -->
  2567. <tr>
  2568. <th>Element and Attribute Namespaces</th>
  2569. <td>
  2570. <ul>
  2571. <li>Global element and attribute declarations belong to this schema's target namespace.</li>
  2572. <li>
  2573. <xsl:choose>
  2574. <xsl:when test="normalize-space(@elementFormDefault)='qualified'">
  2575. <xsl:text>By default, local element declarations belong to this schema's target namespace.</xsl:text>
  2576. </xsl:when>
  2577. <xsl:otherwise>
  2578. <xsl:text>By default, local element declarations have no namespace.</xsl:text>
  2579. </xsl:otherwise>
  2580. </xsl:choose>
  2581. </li>
  2582. <li>
  2583. <xsl:choose>
  2584. <xsl:when test="normalize-space(@attributeFormDefault)='qualified'">
  2585. <xsl:text>By default, local attribute declarations belong to this schema's target namespace.</xsl:text>
  2586. </xsl:when>
  2587. <xsl:otherwise>
  2588. <xsl:text>By default, local attribute declarations have no namespace.</xsl:text>
  2589. </xsl:otherwise>
  2590. </xsl:choose>
  2591. </li>
  2592. </ul>
  2593. </td>
  2594. </tr>
  2595. <!-- Schema Composition, e.g. include, import, redefine -->
  2596. <xsl:if test="xsd:include or xsd:import or xsd:redefine">
  2597. <tr>
  2598. <th>Schema Composition</th>
  2599. <td>
  2600. <ul>
  2601. <!-- Import -->
  2602. <xsl:if test="xsd:import">
  2603. <li>
  2604. <xsl:text>This schema imports schema(s) from the following namespace(s):</xsl:text>
  2605. <ul>
  2606. <xsl:for-each select="xsd:import">
  2607. <li>
  2608. <em><xsl:value-of select="@namespace"/></em>
  2609. <xsl:if test="@schemaLocation">
  2610. <xsl:text> (at </xsl:text>
  2611. <xsl:call-template name="PrintSchemaLink">
  2612. <xsl:with-param name="uri" select="@schemaLocation"/>
  2613. </xsl:call-template>
  2614. <xsl:text>)</xsl:text>
  2615. </xsl:if>
  2616. </li>
  2617. </xsl:for-each>
  2618. </ul>
  2619. </li>
  2620. </xsl:if>
  2621. <!-- Include -->
  2622. <xsl:if test="xsd:include">
  2623. <li>
  2624. <xsl:text>This schema includes components from the following schema document(s):</xsl:text>
  2625. <ul>
  2626. <xsl:for-each select="xsd:include">
  2627. <li>
  2628. <xsl:call-template name="PrintSchemaLink">
  2629. <xsl:with-param name="uri" select="@schemaLocation"/>
  2630. </xsl:call-template>
  2631. </li>
  2632. </xsl:for-each>
  2633. </ul>
  2634. </li>
  2635. </xsl:if>
  2636. <!-- Redefine -->
  2637. <xsl:if test="xsd:redefine">
  2638. <li>
  2639. <xsl:text>This schema includes components from the following schema document(s), where some of the components have been redefined:</xsl:text>
  2640. <ul>
  2641. <xsl:for-each select="xsd:redefine">
  2642. <li>
  2643. <xsl:call-template name="PrintSchemaLink">
  2644. <xsl:with-param name="uri" select="@schemaLocation"/>
  2645. </xsl:call-template>
  2646. </li>
  2647. </xsl:for-each>
  2648. </ul>
  2649. <xsl:text>See </xsl:text><a href="#Redefinitions">Redefined Schema Components</a><xsl:text> section.</xsl:text>
  2650. </li>
  2651. </xsl:if>
  2652. </ul>
  2653. </td>
  2654. </tr>
  2655. </xsl:if>
  2656. <!-- Annotation -->
  2657. <xsl:call-template name="PrintAnnotation">
  2658. <xsl:with-param name="component" select="."/>
  2659. </xsl:call-template>
  2660. </table>
  2661. </xsl:template>
  2662. <!--
  2663. Prints out the Properties table for a top-level
  2664. simple type definition.
  2665. -->
  2666. <xsl:template match="xsd:simpleType" mode="properties">
  2667. <table class="properties">
  2668. <!-- Name -->
  2669. <tr>
  2670. <th>Name</th>
  2671. <td><xsl:value-of select="@name"/></td>
  2672. </tr>
  2673. <!-- Constraints -->
  2674. <tr>
  2675. <th>Content</th>
  2676. <td>
  2677. <xsl:call-template name="PrintSimpleConstraints">
  2678. <xsl:with-param name="simpleContent" select="."/>
  2679. </xsl:call-template>
  2680. </td>
  2681. </tr>
  2682. <!-- Final -->
  2683. <xsl:variable name="final">
  2684. <xsl:call-template name="PrintSimpleDerivationSet">
  2685. <xsl:with-param name="EBV">
  2686. <xsl:choose>
  2687. <xsl:when test="@final">
  2688. <xsl:value-of select="@final"/>
  2689. </xsl:when>
  2690. <xsl:otherwise>
  2691. <xsl:value-of select="/xsd:schema/@finalDefault"/>
  2692. </xsl:otherwise>
  2693. </xsl:choose>
  2694. </xsl:with-param>
  2695. </xsl:call-template>
  2696. </xsl:variable>
  2697. <xsl:if test="normalize-space($final)!=''">
  2698. <tr>
  2699. <th>
  2700. <xsl:call-template name="PrintGlossaryTermRef">
  2701. <xsl:with-param name="code">TypeFinal</xsl:with-param>
  2702. <xsl:with-param name="term">Prohibited Derivations</xsl:with-param>
  2703. </xsl:call-template>
  2704. </th>
  2705. <td><xsl:value-of select="$final"/></td>
  2706. </tr>
  2707. </xsl:if>
  2708. <!-- Annotation -->
  2709. <xsl:call-template name="PrintAnnotation">
  2710. <xsl:with-param name="component" select="."/>
  2711. </xsl:call-template>
  2712. </table>
  2713. </xsl:template>
  2714. <!--
  2715. Unmatched template for 'properties' mode
  2716. -->
  2717. <xsl:template match="*" mode="properties"/>
  2718. <!--
  2719. Prints out the rows to display 'annotation' elements of an
  2720. component in the Properties table. This template assumes it
  2721. will be called within an HTML 'table' element.
  2722. Param(s):
  2723. component (Node) required
  2724. Schema component
  2725. -->
  2726. <xsl:template name="PrintAnnotation">
  2727. <xsl:param name="component"/>
  2728. <xsl:if test="$component/xsd:annotation/xsd:documentation">
  2729. <tr>
  2730. <th>Documentation</th>
  2731. <td>
  2732. <xsl:for-each select="$component/xsd:annotation/xsd:documentation">
  2733. <xsl:if test="position()!=1"><br/><br/></xsl:if>
  2734. <xsl:apply-templates select="." mode="properties"/>
  2735. </xsl:for-each>
  2736. </td>
  2737. </tr>
  2738. </xsl:if>
  2739. <xsl:if test="$component/xsd:annotation/xsd:appinfo">
  2740. <tr>
  2741. <th>Application Data</th>
  2742. <td>
  2743. <xsl:for-each select="$component/xsd:annotation/xsd:appinfo">
  2744. <xsl:if test="position()!=1"><br/><br/></xsl:if>
  2745. <xsl:apply-templates select="." mode="properties"/>
  2746. </xsl:for-each>
  2747. </td>
  2748. </tr>
  2749. </xsl:if>
  2750. </xsl:template>
  2751. <!--
  2752. Prints out the constraints of simple content
  2753. to be displayed within a Properties table.
  2754. Param(s):
  2755. simpleContent (Node) required
  2756. Node containing the simple content
  2757. typeList (String) optional
  2758. List of types in this call chain. Name of type starts
  2759. with '*', and ends with '+'. (Used to prevent infinite
  2760. recursive loop.)
  2761. -->
  2762. <xsl:template name="PrintSimpleConstraints">
  2763. <xsl:param name="simpleContent"/>
  2764. <xsl:param name="typeList"/>
  2765. <xsl:choose>
  2766. <!-- Derivation by restriction -->
  2767. <xsl:when test="$simpleContent/xsd:restriction">
  2768. <xsl:call-template name="PrintSimpleRestriction">
  2769. <xsl:with-param name="restriction" select="$simpleContent/xsd:restriction"/>
  2770. <xsl:with-param name="typeList" select="$typeList"/>
  2771. </xsl:call-template>
  2772. </xsl:when>
  2773. <!-- Derivation by list -->
  2774. <xsl:when test="$simpleContent/xsd:list">
  2775. <ul><li>
  2776. <xsl:text>List of: </xsl:text>
  2777. <xsl:choose>
  2778. <!-- Globally-defined item type -->
  2779. <xsl:when test="$simpleContent/xsd:list/@itemType">
  2780. <xsl:call-template name="PrintTypeRef">
  2781. <xsl:with-param name="ref" select="$simpleContent/xsd:list/@itemType"/>
  2782. </xsl:call-template>
  2783. </xsl:when>
  2784. <!-- Locally-defined item type -->
  2785. <xsl:otherwise>
  2786. <ul>
  2787. <li>
  2788. <xsl:text>Locally defined type:</xsl:text>
  2789. <xsl:call-template name="PrintSimpleConstraints">
  2790. <xsl:with-param name="simpleContent" select="$simpleContent/xsd:list/xsd:simpleType"/>
  2791. <xsl:with-param name="typeList" select="$typeList"/>
  2792. </xsl:call-template>
  2793. </li>
  2794. </ul>
  2795. </xsl:otherwise>
  2796. </xsl:choose>
  2797. </li></ul>
  2798. </xsl:when>
  2799. <!-- Derivation by union -->
  2800. <xsl:when test="$simpleContent/xsd:union">
  2801. <ul><li>
  2802. <xsl:text>Union of following types: </xsl:text>
  2803. <ul>
  2804. <!-- Globally-defined member types -->
  2805. <xsl:if test="$simpleContent/xsd:union/@memberTypes">
  2806. <xsl:call-template name="PrintWhitespaceList">
  2807. <xsl:with-param name="value" select="$simpleContent/xsd:union/@memberTypes"/>
  2808. <xsl:with-param name="compType">type</xsl:with-param>
  2809. <xsl:with-param name="isInList">true</xsl:with-param>
  2810. </xsl:call-template>
  2811. </xsl:if>
  2812. <!-- Locally-defined member types -->
  2813. <xsl:for-each select="$simpleContent/xsd:union/xsd:simpleType">
  2814. <li>
  2815. <xsl:text>Locally defined type:</xsl:text>
  2816. <xsl:call-template name="PrintSimpleConstraints">
  2817. <xsl:with-param name="simpleContent" select="."/>
  2818. <xsl:with-param name="typeList" select="$typeList"/>
  2819. </xsl:call-template>
  2820. </li>
  2821. </xsl:for-each>
  2822. </ul>
  2823. </li></ul>
  2824. </xsl:when>
  2825. </xsl:choose>
  2826. </xsl:template>
  2827. <!--
  2828. Prints out the constraints of simple content derived by
  2829. restriction, which is to be displayed in a Properties table.
  2830. Param(s):
  2831. restriction (Node) required
  2832. Node containing the restriction
  2833. typeList (String) optional
  2834. List of types in this call chain. Name of type starts
  2835. with '*', and ends with '+'. (Used to prevent infinite
  2836. recursive loop.)
  2837. -->
  2838. <xsl:template name="PrintSimpleRestriction">
  2839. <xsl:param name="restriction"/>
  2840. <xsl:param name="typeList"/>
  2841. <xsl:variable name="typeName" select="$restriction/parent::xsd:simpleType/@name"/>
  2842. <!-- Print out base type info -->
  2843. <xsl:choose>
  2844. <!-- Circular type hierarchy -->
  2845. <xsl:when test="$typeName != '' and contains($typeList, concat('*', $typeName, '+'))">
  2846. <li>
  2847. <xsl:call-template name="HandleError">
  2848. <xsl:with-param name="isTerminating">false</xsl:with-param>
  2849. <xsl:with-param name="errorMsg">
  2850. <xsl:text>Circular type reference to '</xsl:text>
  2851. <xsl:value-of select="$typeName"/>
  2852. <xsl:text>' in type hierarchy.</xsl:text>
  2853. </xsl:with-param>
  2854. </xsl:call-template>
  2855. </li>
  2856. </xsl:when>
  2857. <!-- Locally-defined base type -->
  2858. <xsl:when test="$restriction/xsd:simpleType">
  2859. <xsl:call-template name="PrintSimpleConstraints">
  2860. <xsl:with-param name="simpleContent" select="$restriction/xsd:simpleType"/>
  2861. <xsl:with-param name="typeList" select="$typeList"/>
  2862. </xsl:call-template>
  2863. </xsl:when>
  2864. <!-- Base type reference -->
  2865. <xsl:when test="$restriction">
  2866. <xsl:variable name="baseTypeRef" select="$restriction/@base"/>
  2867. <xsl:variable name="baseTypeName">
  2868. <xsl:call-template name="GetRefName">
  2869. <xsl:with-param name="ref" select="$baseTypeRef"/>
  2870. </xsl:call-template>
  2871. </xsl:variable>
  2872. <xsl:variable name="baseTypeNS">
  2873. <xsl:call-template name="GetRefNS">
  2874. <xsl:with-param name="ref" select="$baseTypeRef"/>
  2875. </xsl:call-template>
  2876. </xsl:variable>
  2877. <xsl:choose>
  2878. <!-- Base type is built-in XSD type -->
  2879. <xsl:when test="$baseTypeNS=$XSD_NS">
  2880. <ul><li>
  2881. <xsl:text>Base XSD Type: </xsl:text>
  2882. <xsl:choose>
  2883. <!-- Current schema is the schema for XSDL -->
  2884. <xsl:when test="normalize-space(/xsd:schema/@targetNamespace)=$XSD_NS">
  2885. <xsl:call-template name="PrintTypeRef">
  2886. <xsl:with-param name="ref" select="$baseTypeRef"/>
  2887. </xsl:call-template>
  2888. </xsl:when>
  2889. <!-- Current schema is not XSD namespace -->
  2890. <xsl:otherwise>
  2891. <xsl:value-of select="$baseTypeName"/>
  2892. </xsl:otherwise>
  2893. </xsl:choose>
  2894. </li></ul>
  2895. </xsl:when>
  2896. <!-- Other types -->
  2897. <xsl:otherwise>
  2898. <xsl:variable name="baseType" select="key('simpleType', $baseTypeName)"/>
  2899. <xsl:choose>
  2900. <!-- Base type found -->
  2901. <xsl:when test="$baseType">
  2902. <xsl:call-template name="PrintSimpleConstraints">
  2903. <xsl:with-param name="simpleContent" select="$baseType"/>
  2904. <xsl:with-param name="typeList" select="concat($typeList, '*', $typeName, '+')"/>
  2905. </xsl:call-template>
  2906. </xsl:when>
  2907. <!-- Base type not found -->
  2908. <xsl:otherwise>
  2909. <ul><li><strong>
  2910. <xsl:text>'</xsl:text>
  2911. <xsl:value-of select="$baseTypeName"/>
  2912. <xsl:text>' super type was not found in this schema. </xsl:text>
  2913. <xsl:text>Its facets could not be printed out.</xsl:text>
  2914. </strong></li></ul>
  2915. </xsl:otherwise>
  2916. </xsl:choose>
  2917. </xsl:otherwise>
  2918. </xsl:choose>
  2919. </xsl:when>
  2920. </xsl:choose>
  2921. <!-- Find constraints in current restriction -->
  2922. <xsl:variable name="enumeration">
  2923. <xsl:call-template name="PrintEnumFacets">
  2924. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  2925. </xsl:call-template>
  2926. </xsl:variable>
  2927. <xsl:variable name="pattern">
  2928. <xsl:call-template name="PrintPatternFacet">
  2929. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  2930. </xsl:call-template>
  2931. </xsl:variable>
  2932. <xsl:variable name="range">
  2933. <xsl:call-template name="PrintRangeFacets">
  2934. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  2935. </xsl:call-template>
  2936. </xsl:variable>
  2937. <xsl:variable name="totalDigits">
  2938. <xsl:call-template name="PrintTotalDigitsFacet">
  2939. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  2940. </xsl:call-template>
  2941. </xsl:variable>
  2942. <xsl:variable name="fractionDigits">
  2943. <xsl:call-template name="PrintFractionDigitsFacet">
  2944. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  2945. </xsl:call-template>
  2946. </xsl:variable>
  2947. <xsl:variable name="length">
  2948. <xsl:call-template name="PrintLengthFacets">
  2949. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  2950. </xsl:call-template>
  2951. </xsl:variable>
  2952. <xsl:variable name="whitespace">
  2953. <xsl:call-template name="PrintWhitespaceFacet">
  2954. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  2955. </xsl:call-template>
  2956. </xsl:variable>
  2957. <!-- Print out facets -->
  2958. <xsl:if test="$enumeration!='' or $pattern!='' or $range!='' or $totalDigits!='' or $fractionDigits!='' or $length!='' or $whitespace!=''">
  2959. <ul>
  2960. <xsl:if test="$enumeration!=''">
  2961. <li>
  2962. <xsl:copy-of select="$enumeration"/>
  2963. </li>
  2964. </xsl:if>
  2965. <xsl:if test="$pattern!=''">
  2966. <li>
  2967. <xsl:copy-of select="$pattern"/>
  2968. </li>
  2969. </xsl:if>
  2970. <xsl:if test="$range!=''">
  2971. <li>
  2972. <xsl:copy-of select="$range"/>
  2973. </li>
  2974. </xsl:if>
  2975. <xsl:if test="$totalDigits!=''">
  2976. <li>
  2977. <xsl:copy-of select="$totalDigits"/>
  2978. </li>
  2979. </xsl:if>
  2980. <xsl:if test="$fractionDigits!=''">
  2981. <li>
  2982. <xsl:copy-of select="$fractionDigits"/>
  2983. </li>
  2984. </xsl:if>
  2985. <xsl:if test="$length!=''">
  2986. <li>
  2987. <xsl:copy-of select="$length"/>
  2988. </li>
  2989. </xsl:if>
  2990. <xsl:if test="$whitespace!=''">
  2991. <li>
  2992. <xsl:copy-of select="$whitespace"/>
  2993. </li>
  2994. </xsl:if>
  2995. </ul>
  2996. </xsl:if>
  2997. </xsl:template>
  2998. <!-- ******** XML Instance Representation table ******** -->
  2999. <!--
  3000. Prints out the XML Instance Representation table for a top-level
  3001. schema component.
  3002. Param(s):
  3003. component (Node) required
  3004. Top-level schema component
  3005. -->
  3006. <xsl:template name="SampleInstanceTable">
  3007. <xsl:param name="component"/>
  3008. <!-- Not applicable for simple type definitions and notation
  3009. declarations -->
  3010. <xsl:if test="local-name($component)!='simpleType' and local-name($component)!='notation'">
  3011. <xsl:variable name="componentID">
  3012. <xsl:call-template name="GetComponentID">
  3013. <xsl:with-param name="component" select="$component"/>
  3014. </xsl:call-template>
  3015. </xsl:variable>
  3016. <xsl:call-template name="CollapseableBox">
  3017. <xsl:with-param name="id" select="concat($componentID, '_xibox')"/>
  3018. <xsl:with-param name="styleClass">sample</xsl:with-param>
  3019. <xsl:with-param name="caption">XML Instance Representation</xsl:with-param>
  3020. <xsl:with-param name="contents">
  3021. <xsl:apply-templates select="$component" mode="sample"/>
  3022. </xsl:with-param>
  3023. <xsl:with-param name="isOpened">true</xsl:with-param>
  3024. </xsl:call-template>
  3025. </xsl:if>
  3026. </xsl:template>
  3027. <!--
  3028. Prints out a sample XML instance representation of an 'all'
  3029. model group.
  3030. Param(s):
  3031. margin (nonNegativeInteger) optional
  3032. Number of 'em' to indent from left
  3033. isInherited (boolean) optional
  3034. If true, display elements using 'inherited' CSS class.
  3035. isNewField (boolean) optional
  3036. If true, display elements using 'newFields' CSS class.
  3037. schemaLoc (String) optional
  3038. Schema file containing this all model group;
  3039. if in current schema, 'schemaLoc' is set to 'this'
  3040. typeList (String) optional
  3041. List of types in this call chain. Name of type starts
  3042. with '*', and ends with '+'. (Used to prevent infinite
  3043. recursive loop.)
  3044. -->
  3045. <xsl:template match="xsd:all" mode="sample">
  3046. <xsl:param name="margin">0</xsl:param>
  3047. <xsl:param name="isInherited">false</xsl:param>
  3048. <xsl:param name="isNewField">false</xsl:param>
  3049. <xsl:param name="schemaLoc">this</xsl:param>
  3050. <xsl:param name="typeList"/>
  3051. <xsl:if test="normalize-space(@maxOccurs)!='0'">
  3052. <!-- Header -->
  3053. <span class="group" style="margin-left: {$margin}em">
  3054. <xsl:text>Start </xsl:text>
  3055. <xsl:call-template name="PrintGlossaryTermRef">
  3056. <xsl:with-param name="code">All</xsl:with-param>
  3057. <xsl:with-param name="term">All</xsl:with-param>
  3058. </xsl:call-template>
  3059. <!-- Min/max occurs information-->
  3060. <xsl:text> </xsl:text>
  3061. <xsl:call-template name="PrintOccurs">
  3062. <xsl:with-param name="component" select="."/>
  3063. </xsl:call-template>
  3064. <!-- Documentation -->
  3065. <xsl:call-template name="PrintSampleDocumentation">
  3066. <xsl:with-param name="component" select="."/>
  3067. </xsl:call-template>
  3068. </span><br/>
  3069. <!-- Content -->
  3070. <xsl:apply-templates select="xsd:*" mode="sample">
  3071. <xsl:with-param name="margin" select="number($margin) + number($ELEM_INDENT)"/>
  3072. <xsl:with-param name="isInherited" select="$isInherited"/>
  3073. <xsl:with-param name="isNewField" select="$isNewField"/>
  3074. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3075. <xsl:with-param name="typeList" select="$typeList"/>
  3076. </xsl:apply-templates>
  3077. <!-- Footer -->
  3078. <span class="group" style="margin-left: {$margin}em">
  3079. <xsl:text>End All</xsl:text>
  3080. </span><br/>
  3081. </xsl:if>
  3082. </xsl:template>
  3083. <!--
  3084. Prints out a sample XML instance representation of an element
  3085. content wild card.
  3086. Param(s):
  3087. margin (nonNegativeInteger) optional
  3088. Number of 'em' to indent from left
  3089. -->
  3090. <xsl:template match="xsd:any | xsd:anyAttribute" mode="sample">
  3091. <xsl:param name="margin">0</xsl:param>
  3092. <div class="other" style="margin-left: {$margin}em">
  3093. <xsl:call-template name="PrintWildcard">
  3094. <xsl:with-param name="componentType">
  3095. <xsl:choose>
  3096. <xsl:when test="local-name(.)='anyAttribute'">attribute</xsl:when>
  3097. <xsl:otherwise>element</xsl:otherwise>
  3098. </xsl:choose>
  3099. </xsl:with-param>
  3100. <xsl:with-param name="namespace" select="@namespace"/>
  3101. <xsl:with-param name="processContents" select="@processContents"/>
  3102. <xsl:with-param name="minOccurs" select="@minOccurs"/>
  3103. <xsl:with-param name="maxOccurs" select="@maxOccurs"/>
  3104. </xsl:call-template>
  3105. </div>
  3106. </xsl:template>
  3107. <!--
  3108. Prints out a sample XML instance representation
  3109. of an attribute declaration.
  3110. Param(s):
  3111. subTypeAttrs (String) optional
  3112. List of attributes in sub-types of the type that
  3113. contains this attribute
  3114. isInherited (boolean) optional
  3115. If true, display attribute using 'inherited' CSS
  3116. class.
  3117. isNewField (boolean) optional
  3118. If true, display attribute using 'newFields' CSS
  3119. class.
  3120. margin (nonNegativeInteger) optional
  3121. Number of 'em' to indent from left
  3122. addBR (boolean) optional
  3123. If true, add <br/> before attribute.
  3124. schemaLoc (String) optional
  3125. Schema file containing this attribute declaration;
  3126. if in current schema, 'schemaLoc' is set to 'this'.
  3127. -->
  3128. <xsl:template match="xsd:attribute[@name]" mode="sample">
  3129. <xsl:param name="subTypeAttrs"/>
  3130. <xsl:param name="isInherited">false</xsl:param>
  3131. <xsl:param name="isNewField">false</xsl:param>
  3132. <xsl:param name="margin">0</xsl:param>
  3133. <xsl:param name="addBR">false</xsl:param>
  3134. <xsl:param name="schemaLoc">this</xsl:param>
  3135. <!-- Get attribute namespace -->
  3136. <xsl:variable name="attrNS">
  3137. <xsl:call-template name="GetAttributeNS">
  3138. <xsl:with-param name="attribute" select="."/>
  3139. </xsl:call-template>
  3140. </xsl:variable>
  3141. <xsl:choose>
  3142. <xsl:when test="contains($subTypeAttrs, concat('*', normalize-space($attrNS), '+', normalize-space(@name), '+'))">
  3143. <!-- IGNORE: Sub type has attribute with same name;
  3144. Sub-type's attribute declaration will override this
  3145. one. -->
  3146. </xsl:when>
  3147. <xsl:when test="@use and normalize-space(@use)='prohibited'">
  3148. <!-- IGNORE: Attribute is prohibited. -->
  3149. </xsl:when>
  3150. <xsl:otherwise>
  3151. <xsl:if test="$addBR!='false'"><br/></xsl:if>
  3152. <span style="margin-left: {$margin}em">
  3153. <xsl:choose>
  3154. <xsl:when test="$isNewField!='false'">
  3155. <xsl:attribute name="class">newFields</xsl:attribute>
  3156. </xsl:when>
  3157. <xsl:when test="$isInherited!='false'">
  3158. <xsl:attribute name="class">inherited</xsl:attribute>
  3159. </xsl:when>
  3160. </xsl:choose>
  3161. <xsl:text> </xsl:text>
  3162. <xsl:variable name="prefix">
  3163. <xsl:call-template name="GetAttributePrefix">
  3164. <xsl:with-param name="attribute" select="."/>
  3165. </xsl:call-template>
  3166. </xsl:variable>
  3167. <xsl:call-template name="PrintNSPrefix">
  3168. <xsl:with-param name="prefix" select="$prefix"/>
  3169. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3170. </xsl:call-template>
  3171. <xsl:value-of select="@name"/>
  3172. <xsl:text>="</xsl:text>
  3173. <xsl:choose>
  3174. <!-- Fixed value is provided -->
  3175. <xsl:when test="@fixed">
  3176. <span class="fixed">
  3177. <xsl:value-of select="@fixed"/>
  3178. </span>
  3179. </xsl:when>
  3180. <!-- Type reference is provided -->
  3181. <xsl:when test="@type">
  3182. <xsl:call-template name="PrintTypeRef">
  3183. <xsl:with-param name="ref" select="@type"/>
  3184. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3185. </xsl:call-template>
  3186. </xsl:when>
  3187. <!-- Local type definition is provided -->
  3188. <xsl:when test="xsd:simpleType">
  3189. <xsl:apply-templates select="xsd:simpleType" mode="sample">
  3190. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3191. </xsl:apply-templates>
  3192. </xsl:when>
  3193. <xsl:otherwise>
  3194. <span class="type">anySimpleType</span>
  3195. </xsl:otherwise>
  3196. </xsl:choose>
  3197. <!-- Don't print occurrence info and documentation
  3198. for global attributes. -->
  3199. <xsl:if test="local-name(..)!='schema'">
  3200. <!-- Occurrence info-->
  3201. <xsl:text> </xsl:text>
  3202. <xsl:call-template name="PrintOccurs">
  3203. <xsl:with-param name="component" select="."/>
  3204. </xsl:call-template>
  3205. <!-- Documentation -->
  3206. <xsl:call-template name="PrintSampleDocumentation">
  3207. <xsl:with-param name="component" select="."/>
  3208. </xsl:call-template>
  3209. </xsl:if>
  3210. <xsl:text>"</xsl:text>
  3211. </span>
  3212. </xsl:otherwise>
  3213. </xsl:choose>
  3214. </xsl:template>
  3215. <!--
  3216. Prints out a sample XML instance representation
  3217. of an attribute reference.
  3218. Param(s):
  3219. subTypeAttrs (String) optional
  3220. List of attribute in sub-types of the type that
  3221. contains this attribute
  3222. isInherited (boolean) optional
  3223. If true, display attributes using 'inherited' CSS
  3224. class.
  3225. isNewField (boolean) optional
  3226. If true, display attributes using 'newFields' CSS
  3227. class.
  3228. margin (nonNegativeInteger) optional
  3229. Number of 'em' to indent from left
  3230. addBR (boolean) optional
  3231. If true, add <br/> before attribute.
  3232. schemaLoc (String) optional
  3233. Schema file containing this attribute reference;
  3234. if in current schema, 'schemaLoc' is set to 'this'
  3235. -->
  3236. <xsl:template match="xsd:attribute[@ref]" mode="sample">
  3237. <xsl:param name="subTypeAttrs"/>
  3238. <xsl:param name="isInherited">false</xsl:param>
  3239. <xsl:param name="isNewField">false</xsl:param>
  3240. <xsl:param name="margin">0</xsl:param>
  3241. <xsl:param name="addBR">false</xsl:param>
  3242. <xsl:param name="schemaLoc">this</xsl:param>
  3243. <!-- Get attribute name -->
  3244. <xsl:variable name="attrName">
  3245. <xsl:call-template name="GetRefName">
  3246. <xsl:with-param name="ref" select="@ref"/>
  3247. </xsl:call-template>
  3248. </xsl:variable>
  3249. <!-- Get attribute namespace -->
  3250. <xsl:variable name="attrNS">
  3251. <xsl:call-template name="GetAttributeNS">
  3252. <xsl:with-param name="attribute" select="."/>
  3253. </xsl:call-template>
  3254. </xsl:variable>
  3255. <xsl:choose>
  3256. <xsl:when test="contains($subTypeAttrs, concat('*', normalize-space($attrNS), '+', normalize-space($attrName), '+'))">
  3257. <!-- IGNORE: Sub type has attribute with same name;
  3258. Sub-type's attribute declaration will override this
  3259. one. -->
  3260. </xsl:when>
  3261. <xsl:when test="@use and normalize-space(@use)='prohibited'">
  3262. <!-- IGNORE: Attribute is prohibited. -->
  3263. </xsl:when>
  3264. <xsl:otherwise>
  3265. <xsl:if test="$addBR!='false'"><br/></xsl:if>
  3266. <span style="margin-left: {$margin}em">
  3267. <xsl:choose>
  3268. <xsl:when test="$isNewField!='false'">
  3269. <xsl:attribute name="class">newFields</xsl:attribute>
  3270. </xsl:when>
  3271. <xsl:when test="$isInherited!='false'">
  3272. <xsl:attribute name="class">inherited</xsl:attribute>
  3273. </xsl:when>
  3274. </xsl:choose>
  3275. <xsl:text> </xsl:text>
  3276. <xsl:call-template name="PrintAttributeRef">
  3277. <xsl:with-param name="ref" select="@ref"/>
  3278. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3279. </xsl:call-template>
  3280. <xsl:text>="</xsl:text>
  3281. <!-- Fixed value is provided -->
  3282. <xsl:if test="@fixed">
  3283. <span class="fixed">
  3284. <xsl:value-of select="@fixed"/>
  3285. </span>
  3286. <xsl:text> </xsl:text>
  3287. </xsl:if>
  3288. <!-- Print occurs info-->
  3289. <xsl:call-template name="PrintOccurs">
  3290. <xsl:with-param name="component" select="."/>
  3291. </xsl:call-template>
  3292. <!-- Documentation -->
  3293. <xsl:call-template name="PrintSampleDocumentation">
  3294. <xsl:with-param name="component" select="."/>
  3295. </xsl:call-template>
  3296. <xsl:text>"</xsl:text>
  3297. </span>
  3298. </xsl:otherwise>
  3299. </xsl:choose>
  3300. </xsl:template>
  3301. <!--
  3302. Prints out a sample XML instance representation of an attribute
  3303. group definition.
  3304. Param(s):
  3305. schemaLoc (String) optional
  3306. Schema file containing this attribute group
  3307. definition; if in current schema, 'schemaLoc' is
  3308. set to 'this'.
  3309. -->
  3310. <xsl:template match="xsd:attributeGroup[@name]" mode="sample">
  3311. <xsl:param name="schemaLoc">this</xsl:param>
  3312. <xsl:for-each select="xsd:attribute | xsd:attributeGroup | xsd:anyAttribute">
  3313. <xsl:variable name="addBR">
  3314. <xsl:choose>
  3315. <xsl:when test="position()!=1">
  3316. <xsl:text>true</xsl:text>
  3317. </xsl:when>
  3318. <xsl:otherwise>
  3319. <xsl:text>false</xsl:text>
  3320. </xsl:otherwise>
  3321. </xsl:choose>
  3322. </xsl:variable>
  3323. <xsl:apply-templates select="." mode="sample">
  3324. <xsl:with-param name="addBR" select="$addBR"/>
  3325. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3326. </xsl:apply-templates>
  3327. </xsl:for-each>
  3328. </xsl:template>
  3329. <!--
  3330. Prints out a sample XML instance representation of an attribute
  3331. group reference.
  3332. Param(s):
  3333. subTypeAttrs (String) optional
  3334. List of attributes in sub-types of the type that
  3335. contains this attribute group
  3336. isInherited (boolean) optional
  3337. If true, display attributes using 'inherited' CSS
  3338. class.
  3339. isNewField (boolean) optional
  3340. If true, display attributes using 'newFields' CSS
  3341. class.
  3342. margin (nonNegativeInteger) optional
  3343. Number of 'em' to indent from left
  3344. parentGroups (String) optional
  3345. List of parent attribute group definitions that
  3346. contain this attribute group. Used to prevent
  3347. infinite loops when displaying attribute group
  3348. definitions. In such a case, writes out an error
  3349. message and stops processing.
  3350. schemaLoc (String) optional
  3351. Schema file containing this attribute group
  3352. reference if in current schema, 'schemaLoc' is
  3353. set to 'this'.
  3354. -->
  3355. <xsl:template match="xsd:attributeGroup[@ref]" mode="sample">
  3356. <xsl:param name="subTypeAttrs"/>
  3357. <xsl:param name="isInherited">false</xsl:param>
  3358. <xsl:param name="isNewField">false</xsl:param>
  3359. <xsl:param name="margin">0</xsl:param>
  3360. <xsl:param name="parentGroups"/>
  3361. <xsl:param name="schemaLoc">this</xsl:param>
  3362. <!-- Get attribute group name -->
  3363. <xsl:variable name="attrGrpName">
  3364. <xsl:call-template name="GetRefName">
  3365. <xsl:with-param name="ref" select="@ref"/>
  3366. </xsl:call-template>
  3367. </xsl:variable>
  3368. <xsl:choose>
  3369. <xsl:when test="contains($parentGroups, concat('*', normalize-space($attrGrpName), '+'))">
  3370. <!-- Circular attribute group definition -->
  3371. <xsl:call-template name="HandleError">
  3372. <xsl:with-param name="isTerminating">false</xsl:with-param>
  3373. <xsl:with-param name="errorMsg">
  3374. <xsl:text>Circular attribute group reference: </xsl:text>
  3375. <xsl:value-of select="$attrGrpName"/>
  3376. </xsl:with-param>
  3377. </xsl:call-template>
  3378. </xsl:when>
  3379. <xsl:otherwise>
  3380. <!-- Look for attribute group definition -->
  3381. <xsl:variable name="defLoc">
  3382. <xsl:call-template name="FindComponent">
  3383. <xsl:with-param name="ref" select="@ref"/>
  3384. <xsl:with-param name="compType">attribute group</xsl:with-param>
  3385. </xsl:call-template>
  3386. </xsl:variable>
  3387. <xsl:choose>
  3388. <!-- Not found -->
  3389. <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">
  3390. <div class="other" style="margin-left: {$margin}em">
  3391. <xsl:text>Attribute group reference (not shown): </xsl:text>
  3392. <xsl:call-template name="PrintAttributeGroupRef">
  3393. <xsl:with-param name="ref" select="@ref"/>
  3394. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3395. </xsl:call-template>
  3396. <!-- Documentation -->
  3397. <xsl:call-template name="PrintSampleDocumentation">
  3398. <xsl:with-param name="component" select="."/>
  3399. </xsl:call-template>
  3400. </div>
  3401. </xsl:when>
  3402. <!-- Found in current schema -->
  3403. <xsl:when test="normalize-space($defLoc)='this'">
  3404. <xsl:variable name="attrGrpDef" select="key('attributeGroup', $attrGrpName)"/>
  3405. <xsl:apply-templates select="$attrGrpDef/xsd:attribute | $attrGrpDef/xsd:attributeGroup" mode="sample">
  3406. <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
  3407. <xsl:with-param name="isInherited" select="$isInherited"/>
  3408. <xsl:with-param name="isNewField" select="$isNewField"/>
  3409. <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($attrGrpName), '+'))"/>
  3410. <xsl:with-param name="margin" select="$margin"/>
  3411. <xsl:with-param name="addBR">true</xsl:with-param>
  3412. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3413. </xsl:apply-templates>
  3414. </xsl:when>
  3415. <!-- Found in external schema -->
  3416. <xsl:otherwise>
  3417. <xsl:variable name="attrGrpDef" select="document($defLoc)/xsd:schema/xsd:attributeGroup[@name=$attrGrpName]"/>
  3418. <xsl:apply-templates select="$attrGrpDef/xsd:attribute | $attrGrpDef/xsd:attributeGroup" mode="sample">
  3419. <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
  3420. <xsl:with-param name="isInherited" select="$isInherited"/>
  3421. <xsl:with-param name="isNewField" select="$isNewField"/>
  3422. <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($attrGrpName), '+'))"/>
  3423. <xsl:with-param name="margin" select="$margin"/>
  3424. <xsl:with-param name="addBR">true</xsl:with-param>
  3425. <xsl:with-param name="schemaLoc" select="$defLoc"/>
  3426. </xsl:apply-templates>
  3427. </xsl:otherwise>
  3428. </xsl:choose>
  3429. </xsl:otherwise>
  3430. </xsl:choose>
  3431. </xsl:template>
  3432. <!--
  3433. Prints out a sample XML instance representation of a 'choice'
  3434. model group.
  3435. Param(s):
  3436. margin (nonNegativeInteger) optional
  3437. Number of 'em' to indent from left
  3438. isInherited (boolean) optional
  3439. If true, display elements using'inherited' CSS class.
  3440. isNewField (boolean) optional
  3441. If true, display elements using 'newFields' CSS class.
  3442. parentGroups (String) optional
  3443. List of parent model group definitions that contain this
  3444. model group. Used to prevent infinite loops when
  3445. displaying model group definitions.
  3446. schemaLoc (String) optional
  3447. Schema file containing this choice model group;
  3448. if in current schema, 'schemaLoc' is set to 'this'
  3449. typeList (String) optional
  3450. List of types in this call chain. Name of type starts
  3451. with '*', and ends with '+'. (Used to prevent infinite
  3452. recursive loop.)
  3453. -->
  3454. <xsl:template match="xsd:choice" mode="sample">
  3455. <xsl:param name="margin">0</xsl:param>
  3456. <xsl:param name="isInherited">false</xsl:param>
  3457. <xsl:param name="isNewField">false</xsl:param>
  3458. <xsl:param name="parentGroups"/>
  3459. <xsl:param name="schemaLoc">this</xsl:param>
  3460. <xsl:param name="typeList"/>
  3461. <xsl:if test="normalize-space(@maxOccurs)!='0'">
  3462. <!-- Header -->
  3463. <span class="group" style="margin-left: {$margin}em">
  3464. <xsl:text>Start </xsl:text>
  3465. <xsl:call-template name="PrintGlossaryTermRef">
  3466. <xsl:with-param name="code">Choice</xsl:with-param>
  3467. <xsl:with-param name="term">Choice</xsl:with-param>
  3468. </xsl:call-template>
  3469. <!-- Min/max occurrence -->
  3470. <xsl:text> </xsl:text>
  3471. <xsl:call-template name="PrintOccurs">
  3472. <xsl:with-param name="component" select="."/>
  3473. </xsl:call-template>
  3474. <!-- Documentation -->
  3475. <xsl:call-template name="PrintSampleDocumentation">
  3476. <xsl:with-param name="component" select="."/>
  3477. </xsl:call-template>
  3478. </span><br/>
  3479. <!-- Content -->
  3480. <xsl:apply-templates select="xsd:*" mode="sample">
  3481. <xsl:with-param name="margin" select="number($margin)+number($ELEM_INDENT)"/>
  3482. <xsl:with-param name="isInherited" select="$isInherited"/>
  3483. <xsl:with-param name="isNewField" select="$isNewField"/>
  3484. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  3485. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3486. <xsl:with-param name="typeList" select="$typeList"/>
  3487. </xsl:apply-templates>
  3488. <!-- Footer -->
  3489. <span class="group" style="margin-left: {$margin}em">
  3490. <xsl:text>End Choice</xsl:text>
  3491. </span><br/>
  3492. </xsl:if>
  3493. </xsl:template>
  3494. <!--
  3495. Prints out a sample XML instance from a complex type definition.
  3496. Param(s):
  3497. schemaLoc (String) optional
  3498. Schema file containing this complex type definition;
  3499. if in current schema, 'schemaLoc' is set to 'this'.
  3500. -->
  3501. <xsl:template match="xsd:complexType" mode="sample">
  3502. <xsl:param name="schemaLoc">this</xsl:param>
  3503. <xsl:param name="parentGroups"/>
  3504. <xsl:call-template name="PrintSampleComplexElement">
  3505. <xsl:with-param name="type" select="."/>
  3506. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3507. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  3508. </xsl:call-template>
  3509. </xsl:template>
  3510. <!--
  3511. Prints out a sample XML instance from an element declaration.
  3512. Param(s):
  3513. margin (nonNegativeInteger) optional
  3514. Number of 'em' to indent from left
  3515. isInherited (boolean) optional
  3516. If true, display elements using 'inherited' CSS class.
  3517. isNewField (boolean) optional
  3518. If true, display elements using 'newFields' CSS class.
  3519. schemaLoc (String) optional
  3520. Schema file containing this element declaration;
  3521. if in current schema, 'schemaLoc' is set to 'this'.
  3522. typeList (String) optional
  3523. List of types in this call chain. Name of type starts
  3524. with '*', and ends with '+'. (Used to prevent infinite
  3525. recursive loop.)
  3526. -->
  3527. <xsl:template match="xsd:element[@name]" mode="sample">
  3528. <xsl:param name="margin">0</xsl:param>
  3529. <xsl:param name="isInherited">false</xsl:param>
  3530. <xsl:param name="isNewField">false</xsl:param>
  3531. <xsl:param name="schemaLoc">this</xsl:param>
  3532. <xsl:param name="typeList"/>
  3533. <xsl:param name="parentGroups"/>
  3534. <xsl:choose>
  3535. <!-- Prohibited element declaration -->
  3536. <xsl:when test="normalize-space(@maxOccurs)='0'">
  3537. <!-- IGNORE if max occurs is zero -->
  3538. </xsl:when>
  3539. <!-- Global element declaration -->
  3540. <xsl:when test="local-name(..)='schema'">
  3541. <xsl:choose>
  3542. <!-- With type reference -->
  3543. <xsl:when test="@type">
  3544. <xsl:variable name="elemTypeName">
  3545. <xsl:call-template name="GetRefName">
  3546. <xsl:with-param name="ref" select="@type"/>
  3547. </xsl:call-template>
  3548. </xsl:variable>
  3549. <!-- Look for complex type definition -->
  3550. <xsl:variable name="defLoc">
  3551. <xsl:call-template name="FindComponent">
  3552. <xsl:with-param name="ref" select="@type"/>
  3553. <xsl:with-param name="compType">complex type</xsl:with-param>
  3554. </xsl:call-template>
  3555. </xsl:variable>
  3556. <xsl:choose>
  3557. <!-- Complex type was found in current
  3558. schema. -->
  3559. <xsl:when test="normalize-space($defLoc)='this'">
  3560. <xsl:variable name="ctype" select="key('complexType', $elemTypeName)"/>
  3561. <xsl:call-template name="PrintSampleComplexElement">
  3562. <xsl:with-param name="element" select="."/>
  3563. <xsl:with-param name="type" select="$ctype"/>
  3564. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  3565. </xsl:call-template>
  3566. </xsl:when>
  3567. <!-- Complex type was not found. -->
  3568. <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">
  3569. <xsl:call-template name="PrintSampleSimpleElement">
  3570. <xsl:with-param name="element" select="."/>
  3571. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3572. </xsl:call-template>
  3573. </xsl:when>
  3574. <!-- Complex type was found in external
  3575. schema. -->
  3576. <xsl:otherwise>
  3577. <xsl:variable name="ctype" select="document($defLoc)/xsd:schema/xsd:complexType[@name=$elemTypeName]"/>
  3578. <xsl:call-template name="PrintSampleComplexElement">
  3579. <xsl:with-param name="element" select="."/>
  3580. <xsl:with-param name="type" select="$ctype"/>
  3581. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  3582. </xsl:call-template>
  3583. </xsl:otherwise>
  3584. </xsl:choose>
  3585. </xsl:when>
  3586. <!-- With local complex type definition -->
  3587. <xsl:when test="xsd:complexType">
  3588. <xsl:call-template name="PrintSampleComplexElement">
  3589. <xsl:with-param name="element" select="."/>
  3590. <xsl:with-param name="type" select="xsd:complexType"/>
  3591. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3592. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  3593. </xsl:call-template>
  3594. </xsl:when>
  3595. <xsl:otherwise>
  3596. <xsl:call-template name="PrintSampleSimpleElement">
  3597. <xsl:with-param name="element" select="."/>
  3598. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3599. </xsl:call-template>
  3600. </xsl:otherwise>
  3601. </xsl:choose>
  3602. </xsl:when>
  3603. <!-- Local element declaration -->
  3604. <xsl:otherwise>
  3605. <xsl:choose>
  3606. <!-- With local complex type definition -->
  3607. <xsl:when test="xsd:complexType">
  3608. <xsl:call-template name="PrintSampleComplexElement">
  3609. <xsl:with-param name="element" select="."/>
  3610. <xsl:with-param name="type" select="xsd:complexType"/>
  3611. <xsl:with-param name="margin" select="$margin"/>
  3612. <xsl:with-param name="isInherited" select="$isInherited"/>
  3613. <xsl:with-param name="isNewField" select="$isNewField"/>
  3614. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3615. <xsl:with-param name="typeList" select="$typeList"/>
  3616. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  3617. </xsl:call-template>
  3618. </xsl:when>
  3619. <xsl:otherwise>
  3620. <xsl:call-template name="PrintSampleSimpleElement">
  3621. <xsl:with-param name="element" select="."/>
  3622. <xsl:with-param name="margin" select="$margin"/>
  3623. <xsl:with-param name="isInherited" select="$isInherited"/>
  3624. <xsl:with-param name="isNewField" select="$isNewField"/>
  3625. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3626. <xsl:with-param name="typeList" select="$typeList"/>
  3627. </xsl:call-template>
  3628. </xsl:otherwise>
  3629. </xsl:choose>
  3630. </xsl:otherwise>
  3631. </xsl:choose>
  3632. </xsl:template>
  3633. <!--
  3634. Prints out a sample XML instance from an element
  3635. reference.
  3636. Param(s):
  3637. margin (nonNegativeInteger) optional
  3638. Number of 'em' to indent from left
  3639. isInherited (boolean) optional
  3640. If true, display elements using 'inherited' CSS class.
  3641. isNewField (boolean) optional
  3642. If true, display elements using 'newFields' CSS class.
  3643. schemaLoc (String) optional
  3644. Schema file containing this element reference;
  3645. if in current schema, 'schemaLoc' is set to 'this'.
  3646. -->
  3647. <xsl:template match="xsd:element[@ref]" mode="sample">
  3648. <xsl:param name="margin">0</xsl:param>
  3649. <xsl:param name="isInherited">false</xsl:param>
  3650. <xsl:param name="isNewField">false</xsl:param>
  3651. <xsl:param name="schemaLoc">this</xsl:param>
  3652. <xsl:if test="normalize-space(@maxOccurs)!='0'">
  3653. <xsl:call-template name="PrintSampleSimpleElement">
  3654. <xsl:with-param name="element" select="."/>
  3655. <xsl:with-param name="margin" select="$margin"/>
  3656. <xsl:with-param name="isInherited" select="$isInherited"/>
  3657. <xsl:with-param name="isNewField" select="$isNewField"/>
  3658. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3659. </xsl:call-template>
  3660. </xsl:if>
  3661. </xsl:template>
  3662. <!--
  3663. Prints out a sample XML instance from a group definition.
  3664. Param(s):
  3665. schemaLoc (String) optional
  3666. Schema file containing this model group definition;
  3667. if in current schema, 'schemaLoc' is set to 'this'
  3668. typeList (String) optional
  3669. List of types in this call chain. Name of type starts
  3670. with '*', and ends with '+'. (Used to prevent infinite
  3671. recursive loop.)
  3672. -->
  3673. <xsl:template match="xsd:group[@name]" mode="sample">
  3674. <xsl:param name="schemaLoc">this</xsl:param>
  3675. <xsl:param name="typeList"/>
  3676. <xsl:apply-templates select="xsd:*" mode="sample">
  3677. <xsl:with-param name="parentGroups" select="concat('*', normalize-space(@name), '+')"/>
  3678. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3679. <xsl:with-param name="typeList" select="$typeList"/>
  3680. </xsl:apply-templates>
  3681. </xsl:template>
  3682. <!--
  3683. Prints out a sample XML instance from a group reference.
  3684. Param(s):
  3685. margin (nonNegativeInteger) optional
  3686. Number of 'em' to indent from left
  3687. isInherited (boolean) optional
  3688. If true, display elements using 'inherited' CSS
  3689. class.
  3690. isNewField (boolean) optional
  3691. If true, display elements using 'newFields' CSS
  3692. class.
  3693. parentGroups (String) optional
  3694. List of parent model group definitions that contain
  3695. this model group. Used to prevent infinite loops
  3696. when displaying model group definitions.
  3697. schemaLoc (String) optional
  3698. Schema file containing this model group reference;
  3699. if in current schema, 'schemaLoc' is set to 'this'
  3700. typeList (String) optional
  3701. List of types in this call chain. Name of type starts
  3702. with '*', and ends with '+'. (Used to prevent infinite
  3703. recursive loop.)
  3704. -->
  3705. <xsl:template match="xsd:group[@ref]" mode="sample">
  3706. <xsl:param name="margin">0</xsl:param>
  3707. <xsl:param name="isInherited">false</xsl:param>
  3708. <xsl:param name="isNewField">false</xsl:param>
  3709. <xsl:param name="parentGroups"/>
  3710. <xsl:param name="schemaLoc">this</xsl:param>
  3711. <xsl:param name="typeList"/>
  3712. <!-- Get group name -->
  3713. <xsl:variable name="grpName">
  3714. <xsl:call-template name="GetRefName">
  3715. <xsl:with-param name="ref" select="@ref"/>
  3716. </xsl:call-template>
  3717. </xsl:variable>
  3718. <!-- Create link to the group definition -->
  3719. <xsl:variable name="grpLink">
  3720. <xsl:call-template name="PrintGroupRef">
  3721. <xsl:with-param name="ref" select="@ref"/>
  3722. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3723. </xsl:call-template>
  3724. </xsl:variable>
  3725. <!-- Get occurrence info -->
  3726. <xsl:variable name="occursInfo">
  3727. <xsl:call-template name="PrintOccurs">
  3728. <xsl:with-param name="component" select="."/>
  3729. </xsl:call-template>
  3730. </xsl:variable>
  3731. <xsl:choose>
  3732. <!-- Circular group definition -->
  3733. <xsl:when test="contains($parentGroups, concat('*', normalize-space($grpName), '+'))">
  3734. <!-- Don't show contents -->
  3735. <div class="other" style="margin-left: {$margin}em">
  3736. <xsl:text>Circular model group reference: </xsl:text>
  3737. <xsl:copy-of select="$grpLink"/>
  3738. <!-- Occurrence info -->
  3739. <xsl:text> </xsl:text>
  3740. <xsl:copy-of select="$occursInfo"/>
  3741. <!-- Documentation -->
  3742. <xsl:call-template name="PrintSampleDocumentation">
  3743. <xsl:with-param name="component" select="."/>
  3744. </xsl:call-template>
  3745. </div>
  3746. </xsl:when>
  3747. <xsl:otherwise>
  3748. <!-- Look for group definition -->
  3749. <xsl:variable name="grpDefLoc">
  3750. <xsl:call-template name="FindComponent">
  3751. <xsl:with-param name="ref" select="@ref"/>
  3752. <xsl:with-param name="compType">group</xsl:with-param>
  3753. </xsl:call-template>
  3754. </xsl:variable>
  3755. <xsl:choose>
  3756. <!-- Not found -->
  3757. <xsl:when test="normalize-space($grpDefLoc)='' or normalize-space($grpDefLoc)='none' or normalize-space($grpDefLoc)='xml' or normalize-space($grpDefLoc)='xsd'">
  3758. <div class="other" style="margin-left: {$margin}em">
  3759. <xsl:text>Model group reference (not shown): </xsl:text>
  3760. <xsl:copy-of select="$grpLink"/>
  3761. <!-- Occurrence info -->
  3762. <xsl:text> </xsl:text>
  3763. <xsl:copy-of select="$occursInfo"/>
  3764. <!-- Documentation -->
  3765. <xsl:call-template name="PrintSampleDocumentation">
  3766. <xsl:with-param name="component" select="."/>
  3767. </xsl:call-template>
  3768. </div>
  3769. </xsl:when>
  3770. <!-- Found in current schema -->
  3771. <xsl:when test="normalize-space($grpDefLoc)='this'">
  3772. <xsl:variable name="grpDef" select="key('group', $grpName)"/>
  3773. <xsl:call-template name="PrintSampleGroup">
  3774. <xsl:with-param name="margin" select="$margin"/>
  3775. <xsl:with-param name="isInherited" select="$isInherited"/>
  3776. <xsl:with-param name="isNewField" select="$isNewField"/>
  3777. <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($grpName), '+'))"/>
  3778. <xsl:with-param name="occursInfo" select="$occursInfo"/>
  3779. <xsl:with-param name="grpLink" select="$grpLink"/>
  3780. <xsl:with-param name="grpRef" select="."/>
  3781. <xsl:with-param name="grpDef" select="$grpDef"/>
  3782. <xsl:with-param name="grpDefLoc" select="$grpDefLoc"/>
  3783. <xsl:with-param name="typeList" select="$typeList"/>
  3784. </xsl:call-template>
  3785. </xsl:when>
  3786. <!-- Found in external schema -->
  3787. <xsl:otherwise>
  3788. <xsl:variable name="grpDef" select="document($grpDefLoc)/xsd:schema/xsd:group[@name=$grpName]"/>
  3789. <xsl:call-template name="PrintSampleGroup">
  3790. <xsl:with-param name="margin" select="$margin"/>
  3791. <xsl:with-param name="isInherited" select="$isInherited"/>
  3792. <xsl:with-param name="isNewField" select="$isNewField"/>
  3793. <xsl:with-param name="parentGroups" select="concat($parentGroups, concat('*', normalize-space($grpName), '+'))"/>
  3794. <xsl:with-param name="occursInfo" select="$occursInfo"/>
  3795. <xsl:with-param name="grpLink" select="$grpLink"/>
  3796. <xsl:with-param name="grpRef" select="."/>
  3797. <xsl:with-param name="grpDef" select="$grpDef"/>
  3798. <xsl:with-param name="grpDefLoc" select="$grpDefLoc"/>
  3799. <xsl:with-param name="typeList" select="$typeList"/>
  3800. </xsl:call-template>
  3801. </xsl:otherwise>
  3802. </xsl:choose>
  3803. </xsl:otherwise>
  3804. </xsl:choose>
  3805. </xsl:template>
  3806. <!--
  3807. Prints out a sample XML instance from a 'sequence' model group.
  3808. Param(s):
  3809. margin (nonNegativeInteger) optional
  3810. Number of 'em' to indent from left
  3811. isInherited (boolean) optional
  3812. If true, display elements using 'inherited' CSS class.
  3813. isNewField (boolean) optional
  3814. If true, display elements using 'newFields' CSS class.
  3815. parentGroups (String) optional
  3816. List of parent model group definitions that contain
  3817. this model group. Used to prevent infinite loops when
  3818. displaying model group definitions.
  3819. schemaLoc (String) optional
  3820. Schema file containing this sequence model group;
  3821. if in current schema, 'schemaLoc' is set to 'this'
  3822. typeList (String) optional
  3823. List of types in this call chain. Name of type starts
  3824. with '*', and ends with '+'. (Used to prevent infinite
  3825. recursive loop.)
  3826. -->
  3827. <xsl:template match="xsd:sequence" mode="sample">
  3828. <xsl:param name="margin">0</xsl:param>
  3829. <xsl:param name="isInherited">false</xsl:param>
  3830. <xsl:param name="isNewField">false</xsl:param>
  3831. <xsl:param name="parentGroups"/>
  3832. <xsl:param name="schemaLoc">this</xsl:param>
  3833. <xsl:param name="typeList"/>
  3834. <xsl:if test="normalize-space(@maxOccurs)!='0'">
  3835. <!-- Get occurrence info -->
  3836. <xsl:variable name="occursInfo">
  3837. <xsl:call-template name="PrintOccurs">
  3838. <xsl:with-param name="component" select="."/>
  3839. </xsl:call-template>
  3840. </xsl:variable>
  3841. <!-- Header -->
  3842. <xsl:if test="normalize-space($occursInfo)!='[1]'">
  3843. <!-- Don't display header if min/max occurs is one. -->
  3844. <span class="group" style="margin-left: {$margin}em">
  3845. <xsl:text>Start </xsl:text>
  3846. <xsl:call-template name="PrintGlossaryTermRef">
  3847. <xsl:with-param name="code">Sequence</xsl:with-param>
  3848. <xsl:with-param name="term">Sequence</xsl:with-param>
  3849. </xsl:call-template>
  3850. <xsl:text> </xsl:text>
  3851. <xsl:copy-of select="$occursInfo"/>
  3852. <!-- Documentation -->
  3853. <xsl:call-template name="PrintSampleDocumentation">
  3854. <xsl:with-param name="component" select="."/>
  3855. </xsl:call-template>
  3856. </span><br/>
  3857. </xsl:if>
  3858. <xsl:apply-templates select="xsd:*" mode="sample">
  3859. <xsl:with-param name="margin">
  3860. <xsl:choose>
  3861. <xsl:when test="normalize-space($occursInfo)='[1]'">
  3862. <xsl:value-of select="$margin"/>
  3863. </xsl:when>
  3864. <xsl:otherwise>
  3865. <xsl:value-of select="number($margin)+number($ELEM_INDENT)"/>
  3866. </xsl:otherwise>
  3867. </xsl:choose>
  3868. </xsl:with-param>
  3869. <xsl:with-param name="isInherited" select="$isInherited"/>
  3870. <xsl:with-param name="isNewField" select="$isNewField"/>
  3871. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  3872. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3873. <xsl:with-param name="typeList" select="$typeList"/>
  3874. </xsl:apply-templates>
  3875. <!-- Footer -->
  3876. <xsl:if test="normalize-space($occursInfo)!='[1]'">
  3877. <!-- Don't display footer if min/max occurs is one. -->
  3878. <span class="group" style="margin-left: {$margin}em">
  3879. <xsl:text>End Sequence</xsl:text>
  3880. </span><br/>
  3881. </xsl:if>
  3882. </xsl:if>
  3883. </xsl:template>
  3884. <!--
  3885. Prints out the constraints of a complex type with simple content
  3886. to be displayed within a sample XML instance.
  3887. Param(s):
  3888. schemaLoc (String) optional
  3889. Schema file containing this simple content
  3890. restriction; if in current schema, 'schemaLoc' is
  3891. set to 'this'
  3892. -->
  3893. <xsl:template match="xsd:simpleContent[xsd:restriction]" mode="sample">
  3894. <xsl:param name="schemaLoc">this</xsl:param>
  3895. <span class="constraint">
  3896. <xsl:call-template name="PrintSampleSimpleRestriction">
  3897. <xsl:with-param name="restriction" select="./xsd:restriction"/>
  3898. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3899. </xsl:call-template>
  3900. </span>
  3901. </xsl:template>
  3902. <!--
  3903. Prints out the constraints of a simple type definition to be
  3904. displayed within a sample XML instance.
  3905. Param(s):
  3906. schemaLoc (String) optional
  3907. Schema file containing this simple type definition;
  3908. if in current schema, 'schemaLoc' is set to 'this'
  3909. -->
  3910. <xsl:template match="xsd:simpleType" mode="sample">
  3911. <xsl:param name="schemaLoc">this</xsl:param>
  3912. <span class="constraint">
  3913. <xsl:call-template name="PrintSampleSimpleConstraints">
  3914. <xsl:with-param name="simpleContent" select="."/>
  3915. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3916. </xsl:call-template>
  3917. </span>
  3918. </xsl:template>
  3919. <!--
  3920. Prints out the identity constraints of an element to be displayed
  3921. within a sample XML instance.
  3922. Param(s):
  3923. margin (nonNegativeInteger) optional
  3924. Number of 'em' to indent from left
  3925. schemaLoc (String) optional
  3926. Schema file containing this simple type definition;
  3927. if in current schema, 'schemaLoc' is set to 'this'
  3928. -->
  3929. <xsl:template match="xsd:unique | xsd:key | xsd:keyref" mode="sample">
  3930. <xsl:param name="margin">0</xsl:param>
  3931. <xsl:param name="schemaLoc">this</xsl:param>
  3932. <div class="other" style="margin-left: {$margin}em">
  3933. <xsl:text>&lt;!-- </xsl:text><br/>
  3934. <xsl:choose>
  3935. <xsl:when test="local-name(.)='unique'">
  3936. <xsl:call-template name="PrintGlossaryTermRef">
  3937. <xsl:with-param name="code">Unique</xsl:with-param>
  3938. <xsl:with-param name="term">Uniqueness</xsl:with-param>
  3939. </xsl:call-template>
  3940. </xsl:when>
  3941. <xsl:when test="local-name(.)='key'">
  3942. <xsl:call-template name="PrintGlossaryTermRef">
  3943. <xsl:with-param name="code">Key</xsl:with-param>
  3944. <xsl:with-param name="term">Key</xsl:with-param>
  3945. </xsl:call-template>
  3946. </xsl:when>
  3947. <xsl:otherwise>
  3948. <xsl:call-template name="PrintGlossaryTermRef">
  3949. <xsl:with-param name="code">KeyRef</xsl:with-param>
  3950. <xsl:with-param name="term">Key Reference</xsl:with-param>
  3951. </xsl:call-template>
  3952. </xsl:otherwise>
  3953. </xsl:choose>
  3954. <xsl:text> Constraint - </xsl:text>
  3955. <strong>
  3956. <xsl:choose>
  3957. <xsl:when test="local-name(.)='keyref'">
  3958. <xsl:value-of select="@name"/>
  3959. </xsl:when>
  3960. <xsl:otherwise>
  3961. <xsl:variable name="componentID">
  3962. <xsl:call-template name="GetComponentID">
  3963. <xsl:with-param name="component" select="."/>
  3964. </xsl:call-template>
  3965. </xsl:variable>
  3966. <a name="{$componentID}"><xsl:value-of select="@name"/></a>
  3967. </xsl:otherwise>
  3968. </xsl:choose>
  3969. </strong><br/>
  3970. <xsl:text>Selector - </xsl:text>
  3971. <strong>
  3972. <xsl:value-of select="xsd:selector/@xpath"/>
  3973. </strong><br/>
  3974. <xsl:text>Field(s) - </xsl:text>
  3975. <xsl:for-each select="xsd:field">
  3976. <xsl:if test="position()!=1">
  3977. <xsl:text>, </xsl:text>
  3978. </xsl:if>
  3979. <strong>
  3980. <xsl:value-of select="@xpath"/>
  3981. </strong>
  3982. </xsl:for-each>
  3983. <br/>
  3984. <xsl:if test="local-name(.)='keyref'">
  3985. <xsl:text>Refers to - </xsl:text>
  3986. <xsl:call-template name="PrintKeyRef">
  3987. <xsl:with-param name="ref" select="@refer"/>
  3988. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  3989. </xsl:call-template>
  3990. <br/>
  3991. </xsl:if>
  3992. <xsl:text>--></xsl:text>
  3993. </div>
  3994. </xsl:template>
  3995. <!--
  3996. Unmatched template for 'sample' mode
  3997. -->
  3998. <xsl:template match="*" mode="sample"/>
  3999. <!--
  4000. Prints out a link which will open up a window, displaying a
  4001. schema component's documentation.
  4002. Param(s):
  4003. component (Node) required
  4004. Schema component
  4005. -->
  4006. <xsl:template name="PrintSampleDocumentation">
  4007. <xsl:param name="component"/>
  4008. <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true' and $component and $component/xsd:annotation/xsd:documentation">
  4009. <xsl:variable name="documentation">
  4010. <xsl:for-each select="$component/xsd:annotation/xsd:documentation">
  4011. <!-- Check for two dashes, which will break the JavaScript
  4012. code -->
  4013. <xsl:if test="contains(., '--') or contains(@source, '--')">
  4014. <xsl:call-template name="HandleError">
  4015. <xsl:with-param name="isTerminating">true</xsl:with-param>
  4016. <xsl:with-param name="errorMsg">
  4017. A local schema component contains two dashes in
  4018. 'documentation' elements within its 'annotation' element.
  4019. </xsl:with-param>
  4020. </xsl:call-template>
  4021. </xsl:if>
  4022. <xsl:if test="position()!=1">
  4023. <xsl:text>,</xsl:text>
  4024. </xsl:if>
  4025. <xsl:text>'</xsl:text>
  4026. <xsl:choose>
  4027. <xsl:when test="@source">
  4028. <xsl:text>More information at: </xsl:text>
  4029. <xsl:call-template name="EscapeQuotes">
  4030. <xsl:with-param name="value" select="@source"/>
  4031. </xsl:call-template>
  4032. <xsl:text>.</xsl:text>
  4033. </xsl:when>
  4034. <xsl:when test="normalize-space(.)!=''">
  4035. <xsl:call-template name="EscapeQuotes">
  4036. <xsl:with-param name="value" select="normalize-space(.)"/>
  4037. </xsl:call-template>
  4038. </xsl:when>
  4039. </xsl:choose>
  4040. <xsl:text>'</xsl:text>
  4041. </xsl:for-each>
  4042. </xsl:variable>
  4043. <xsl:text> </xsl:text>
  4044. <a href="javascript:void(0)" title="View Documentation" class="documentation">
  4045. <!-- onclick attribute -->
  4046. <xsl:attribute name="onclick">
  4047. <xsl:text>docArray = new Array(</xsl:text>
  4048. <xsl:value-of select="$documentation"/>
  4049. <xsl:text>); viewDocumentation('</xsl:text>
  4050. <xsl:call-template name="GetComponentDescription">
  4051. <xsl:with-param name="component" select="$component"/>
  4052. </xsl:call-template>
  4053. <xsl:text>', '</xsl:text>
  4054. <xsl:choose>
  4055. <xsl:when test="$component/@name">
  4056. <xsl:value-of select="$component/@name"/>
  4057. </xsl:when>
  4058. <xsl:when test="$component/@ref">
  4059. <xsl:call-template name="GetRefName">
  4060. <xsl:with-param name="ref" select="$component/@ref"/>
  4061. </xsl:call-template>
  4062. </xsl:when>
  4063. </xsl:choose>
  4064. <xsl:text>', docArray);</xsl:text>
  4065. </xsl:attribute>
  4066. <xsl:text>?</xsl:text>
  4067. </a>
  4068. </xsl:if>
  4069. </xsl:template>
  4070. <!--
  4071. Translates occurrences of single and double quotes
  4072. in a piece of text with single and double quote
  4073. escape characters.
  4074. Param(s):
  4075. value (String) required
  4076. Text to translate
  4077. -->
  4078. <xsl:template name="EscapeQuotes">
  4079. <xsl:param name="value"/>
  4080. <xsl:variable name="noSingleQuotes">
  4081. <xsl:call-template name="TranslateStr">
  4082. <xsl:with-param name="value" select="$value"/>
  4083. <xsl:with-param name="strToReplace">'</xsl:with-param>
  4084. <xsl:with-param name="replacementStr">\'</xsl:with-param>
  4085. </xsl:call-template>
  4086. </xsl:variable>
  4087. <xsl:variable name="noDoubleQuotes">
  4088. <xsl:call-template name="TranslateStr">
  4089. <xsl:with-param name="value" select="$noSingleQuotes"/>
  4090. <xsl:with-param name="strToReplace">"</xsl:with-param>
  4091. <xsl:with-param name="replacementStr">\"</xsl:with-param>
  4092. </xsl:call-template>
  4093. </xsl:variable>
  4094. <xsl:value-of select="$noDoubleQuotes"/>
  4095. </xsl:template>
  4096. <!--
  4097. Helper template for template, match="xsd:group[@ref]"
  4098. mode="sample". Basically prints out a group reference, for
  4099. which we are able to look up the group definition that it
  4100. is referring to. This template is a work-around because XSLT
  4101. doesn't have variables (in the traditional sense of
  4102. programming languages) and it doesn't allow you to query
  4103. result tree fragments.
  4104. Param(s):
  4105. margin (nonNegativeInteger) optional
  4106. Number of 'em' to indent from left
  4107. isInherited (boolean) optional
  4108. If true, display elements using 'inherited' CSS class.
  4109. isNewField (boolean) optional
  4110. If true, display elements using 'newFields' CSS class.
  4111. parentGroups (String) optional
  4112. List of parent model group definitions that contain this
  4113. model group. Used to prevent infinite loops when
  4114. displaying model group definitions.
  4115. occursInfo (Result tree fragment) required
  4116. Pre-formatted occurrence info of group reference
  4117. grpLink (Result tree fragment) required
  4118. Pre-formatted <a> link representing group reference
  4119. grpRef (Node) required
  4120. Group reference
  4121. grpDef (Node) required
  4122. Group definition that the reference is pointing to
  4123. grpDefLoc (String) optional
  4124. Schema file containing 'grpDef' group definition;
  4125. if current schema, 'schemaLoc' is set to 'this'
  4126. typeList (String) optional
  4127. List of types in this call chain. Name of type starts
  4128. with '*', and ends with '+'. (Used to prevent infinite
  4129. recursive loop.)
  4130. -->
  4131. <xsl:template name="PrintSampleGroup">
  4132. <xsl:param name="margin">0</xsl:param>
  4133. <xsl:param name="isInherited">false</xsl:param>
  4134. <xsl:param name="isNewField">false</xsl:param>
  4135. <xsl:param name="parentGroups"/>
  4136. <xsl:param name="occursInfo"/>
  4137. <xsl:param name="grpLink"/>
  4138. <xsl:param name="grpRef"/>
  4139. <xsl:param name="grpDef"/>
  4140. <xsl:param name="grpDefLoc">this</xsl:param>
  4141. <xsl:param name="typeList"/>
  4142. <!-- Header -->
  4143. <xsl:if test="normalize-space($occursInfo)!='[1]'">
  4144. <!-- Don't print out header if min/max occurs is one. -->
  4145. <span class="group" style="margin-left: {$margin}em">
  4146. <xsl:text>Start Group: </xsl:text>
  4147. <xsl:copy-of select="$grpLink"/>
  4148. <!-- Occurrence info -->
  4149. <xsl:text> </xsl:text>
  4150. <xsl:copy-of select="$occursInfo"/>
  4151. <!-- Documentation -->
  4152. <xsl:call-template name="PrintSampleDocumentation">
  4153. <xsl:with-param name="component" select="$grpRef"/>
  4154. </xsl:call-template>
  4155. </span><br/>
  4156. </xsl:if>
  4157. <!-- Content -->
  4158. <xsl:apply-templates select="$grpDef/xsd:*" mode="sample">
  4159. <xsl:with-param name="margin">
  4160. <xsl:choose>
  4161. <xsl:when test="normalize-space($occursInfo)!='[1]'">
  4162. <xsl:value-of select="number($margin)+number($ELEM_INDENT)"/>
  4163. </xsl:when>
  4164. <xsl:otherwise>
  4165. <xsl:value-of select="$margin"/>
  4166. </xsl:otherwise>
  4167. </xsl:choose>
  4168. </xsl:with-param>
  4169. <xsl:with-param name="isInherited" select="$isInherited"/>
  4170. <xsl:with-param name="isNewField" select="$isNewField"/>
  4171. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  4172. <xsl:with-param name="schemaLoc" select="$grpDefLoc"/>
  4173. <xsl:with-param name="typeList" select="$typeList"/>
  4174. </xsl:apply-templates>
  4175. <!-- Footer -->
  4176. <xsl:if test="normalize-space($occursInfo)!='[1]'">
  4177. <!-- Don't print out footer if min/max occurs is one. -->
  4178. <span class="group" style="margin-left: {$margin}em">
  4179. <xsl:text>End Group: </xsl:text>
  4180. <xsl:copy-of select="$grpLink"/>
  4181. </span><br/>
  4182. </xsl:if>
  4183. </xsl:template>
  4184. <!--
  4185. Prints out a sample element instance in one line.
  4186. Param(s):
  4187. element (Node) required
  4188. Element declaration or reference
  4189. margin (nonNegativeInteger) optional
  4190. Number of 'em' to indent from left
  4191. isInherited (boolean) optional
  4192. If true, display element using 'inherited' CSS class.
  4193. isNewField (boolean) optional
  4194. If true, display element using 'newFields' CSS class.
  4195. schemaLoc (String) optional
  4196. Schema file containing this element declaration
  4197. or reference; if in current schema, 'schemaLoc' is
  4198. set to 'this'.
  4199. -->
  4200. <xsl:template name="PrintSampleSimpleElement">
  4201. <xsl:param name="element"/>
  4202. <xsl:param name="margin">0</xsl:param>
  4203. <xsl:param name="isInherited">false</xsl:param>
  4204. <xsl:param name="isNewField">false</xsl:param>
  4205. <xsl:param name="schemaLoc">this</xsl:param>
  4206. <!-- Element Tag -->
  4207. <xsl:variable name="elemTag">
  4208. <!-- Local Name -->
  4209. <xsl:choose>
  4210. <!-- Element reference -->
  4211. <xsl:when test="$element/@ref">
  4212. <!-- Note: Prefix will be automatically written out
  4213. in call to 'PrintElementRef'. -->
  4214. <xsl:call-template name="PrintElementRef">
  4215. <xsl:with-param name="ref" select="@ref"/>
  4216. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4217. </xsl:call-template>
  4218. </xsl:when>
  4219. <!-- Element declaration -->
  4220. <xsl:otherwise>
  4221. <!-- Prefix -->
  4222. <xsl:variable name="prefix">
  4223. <xsl:call-template name="GetElementPrefix">
  4224. <xsl:with-param name="element" select="$element"/>
  4225. </xsl:call-template>
  4226. </xsl:variable>
  4227. <xsl:call-template name="PrintNSPrefix">
  4228. <xsl:with-param name="prefix" select="$prefix"/>
  4229. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4230. </xsl:call-template>
  4231. <xsl:value-of select="$element/@name"/>
  4232. </xsl:otherwise>
  4233. </xsl:choose>
  4234. </xsl:variable>
  4235. <div style="margin-left: {$margin}em">
  4236. <xsl:choose>
  4237. <xsl:when test="$isNewField!='false'">
  4238. <xsl:attribute name="class">newFields</xsl:attribute>
  4239. </xsl:when>
  4240. <xsl:when test="$isInherited!='false'">
  4241. <xsl:attribute name="class">inherited</xsl:attribute>
  4242. </xsl:when>
  4243. </xsl:choose>
  4244. <!-- Start Tag -->
  4245. <xsl:text>&lt;</xsl:text>
  4246. <xsl:copy-of select="$elemTag"/>
  4247. <xsl:text>></xsl:text>
  4248. <!-- Contents -->
  4249. <xsl:text> </xsl:text>
  4250. <xsl:choose>
  4251. <!-- Fixed value is provided -->
  4252. <xsl:when test="$element/@fixed">
  4253. <span class="fixed">
  4254. <xsl:value-of select="$element/@fixed"/>
  4255. </span>
  4256. </xsl:when>
  4257. <!-- Type reference is provided -->
  4258. <xsl:when test="$element/@name and $element/@type">
  4259. <xsl:call-template name="PrintTypeRef">
  4260. <xsl:with-param name="ref" select="$element/@type"/>
  4261. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4262. </xsl:call-template>
  4263. </xsl:when>
  4264. <!-- Local simple type definition is provided -->
  4265. <xsl:when test="$element/@name and $element/xsd:simpleType">
  4266. <xsl:apply-templates select="$element/xsd:simpleType" mode="sample">
  4267. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4268. </xsl:apply-templates>
  4269. </xsl:when>
  4270. <xsl:otherwise>
  4271. <xsl:text>...</xsl:text>
  4272. </xsl:otherwise>
  4273. </xsl:choose>
  4274. <xsl:text> </xsl:text>
  4275. <!-- Identity Constraints -->
  4276. <xsl:if test="$element/xsd:unique or $element/xsd:key or $element/xsd:keyref">
  4277. <xsl:apply-templates select="$element/xsd:unique | $element/xsd:key | $element/xsd:keyref" mode="sample">
  4278. <xsl:with-param name="margin" select="$ELEM_INDENT"/>
  4279. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4280. </xsl:apply-templates>
  4281. </xsl:if>
  4282. <!-- End Tag -->
  4283. <xsl:text>&lt;/</xsl:text>
  4284. <xsl:copy-of select="$elemTag"/>
  4285. <xsl:text>></xsl:text>
  4286. <xsl:if test="local-name($element/..)!='schema'">
  4287. <!-- Min/max occurs information -->
  4288. <xsl:text> </xsl:text>
  4289. <xsl:call-template name="PrintOccurs">
  4290. <xsl:with-param name="component" select="$element"/>
  4291. </xsl:call-template>
  4292. <!-- Documentation -->
  4293. <xsl:call-template name="PrintSampleDocumentation">
  4294. <xsl:with-param name="component" select="$element"/>
  4295. </xsl:call-template>
  4296. </xsl:if>
  4297. </div>
  4298. </xsl:template>
  4299. <!--
  4300. Prints out a sample element instance that has complex content.
  4301. Param(s):
  4302. type (Node) required
  4303. Complex type definition
  4304. element (Node) optional
  4305. Element declaration
  4306. margin (nonNegativeInteger) optional
  4307. Number of 'em' to indent from left
  4308. isInherited (boolean) optional
  4309. If true, display element using 'inherited' CSS class.
  4310. isNewField (boolean) optional
  4311. If true, display element using 'newFields' CSS class.
  4312. schemaLoc (String) optional
  4313. Schema file containing this element declaration
  4314. or type definition; if in current schema, 'schemaLoc'
  4315. is set to 'this'.
  4316. typeList (String) optional
  4317. List of types in this call chain. Name of type starts
  4318. with '*', and ends with '+'. (Used to prevent infinite
  4319. recursive loop.)
  4320. -->
  4321. <xsl:template name="PrintSampleComplexElement">
  4322. <xsl:param name="type"/>
  4323. <xsl:param name="element"/>
  4324. <xsl:param name="margin">0</xsl:param>
  4325. <xsl:param name="isInherited">false</xsl:param>
  4326. <xsl:param name="isNewField">false</xsl:param>
  4327. <xsl:param name="schemaLoc">this</xsl:param>
  4328. <xsl:param name="typeList"/>
  4329. <xsl:param name="parentGroups"/>
  4330. <xsl:choose>
  4331. <!-- Circular type hierarchy -->
  4332. <xsl:when test="$type/@name and contains($typeList, concat('*', $type/@name, '+'))"/>
  4333. <xsl:otherwise>
  4334. <xsl:variable name="tag">
  4335. <xsl:choose>
  4336. <xsl:when test="$element">
  4337. <!-- Prefix -->
  4338. <xsl:variable name="prefix">
  4339. <xsl:call-template name="GetElementPrefix">
  4340. <xsl:with-param name="element" select="$element"/>
  4341. </xsl:call-template>
  4342. </xsl:variable>
  4343. <xsl:call-template name="PrintNSPrefix">
  4344. <xsl:with-param name="prefix" select="$prefix"/>
  4345. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4346. </xsl:call-template>
  4347. <xsl:value-of select="$element/@name"/>
  4348. </xsl:when>
  4349. <xsl:otherwise>
  4350. <xsl:text>...</xsl:text>
  4351. </xsl:otherwise>
  4352. </xsl:choose>
  4353. </xsl:variable>
  4354. <xsl:variable name="fromTopCType">
  4355. <xsl:choose>
  4356. <xsl:when test="not($element) and local-name($type/..)='schema'">
  4357. <xsl:text>true</xsl:text>
  4358. </xsl:when>
  4359. <xsl:otherwise>
  4360. <xsl:text>false</xsl:text>
  4361. </xsl:otherwise>
  4362. </xsl:choose>
  4363. </xsl:variable>
  4364. <div style="margin-left: {$margin}em">
  4365. <xsl:choose>
  4366. <xsl:when test="$isNewField!='false'">
  4367. <xsl:attribute name="class">newFields</xsl:attribute>
  4368. </xsl:when>
  4369. <xsl:when test="$isInherited!='false'">
  4370. <xsl:attribute name="class">inherited</xsl:attribute>
  4371. </xsl:when>
  4372. </xsl:choose>
  4373. <!-- Start Tag -->
  4374. <xsl:text>&lt;</xsl:text>
  4375. <xsl:copy-of select="$tag"/>
  4376. <!-- Print attributes -->
  4377. <xsl:call-template name="PrintSampleTypeAttrs">
  4378. <xsl:with-param name="type" select="$type"/>
  4379. <xsl:with-param name="isInherited" select="$isInherited"/>
  4380. <xsl:with-param name="isNewField" select="$isNewField"/>
  4381. <xsl:with-param name="margin" select="$ATTR_INDENT"/>
  4382. <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
  4383. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4384. <xsl:with-param name="typeList" select="$typeList"/>
  4385. </xsl:call-template>
  4386. <!-- Get content -->
  4387. <xsl:variable name="content">
  4388. <xsl:call-template name="PrintSampleTypeContent">
  4389. <xsl:with-param name="type" select="$type"/>
  4390. <xsl:with-param name="margin" select="$ELEM_INDENT"/>
  4391. <xsl:with-param name="isInherited" select="$isInherited"/>
  4392. <xsl:with-param name="isNewField" select="$isNewField"/>
  4393. <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
  4394. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4395. <xsl:with-param name="typeList" select="$typeList"/>
  4396. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  4397. </xsl:call-template>
  4398. </xsl:variable>
  4399. <!-- Find out if content type is mixed -->
  4400. <xsl:variable name="mixed">
  4401. <xsl:choose>
  4402. <xsl:when test="normalize-space(translate($type/xsd:complexContent/@mixed, 'TRUE', 'true'))='true' or normalize-space($type/xsd:complexContent/@mixed)='1'">
  4403. <xsl:text>true</xsl:text>
  4404. </xsl:when>
  4405. <xsl:when test="normalize-space(translate($type/@mixed, 'TRUE', 'true'))='true' or normalize-space($type/@mixed)='1'">
  4406. <xsl:text>true</xsl:text>
  4407. </xsl:when>
  4408. <xsl:otherwise>
  4409. <xsl:text>false</xsl:text>
  4410. </xsl:otherwise>
  4411. </xsl:choose>
  4412. </xsl:variable>
  4413. <!-- Find out if there are identity constraints -->
  4414. <xsl:variable name="hasIdConstraints">
  4415. <xsl:if test="$element and ($element/xsd:unique or $element/xsd:key or $element/xsd:keyref)">
  4416. <xsl:text>true</xsl:text>
  4417. </xsl:if>
  4418. </xsl:variable>
  4419. <!-- Print content -->
  4420. <xsl:choose>
  4421. <!-- Empty content -->
  4422. <xsl:when test="$hasIdConstraints!='true' and normalize-space($content)=''">
  4423. <!-- Close start tag -->
  4424. <xsl:text>/> </xsl:text>
  4425. <xsl:if test="$element and local-name($element/..)!='schema'">
  4426. <!-- Occurrence info -->
  4427. <xsl:text> </xsl:text>
  4428. <xsl:call-template name="PrintOccurs">
  4429. <xsl:with-param name="component" select="$element"/>
  4430. </xsl:call-template>
  4431. <!-- Documentation -->
  4432. <xsl:call-template name="PrintSampleDocumentation">
  4433. <xsl:with-param name="component" select="$element"/>
  4434. </xsl:call-template>
  4435. </xsl:if>
  4436. </xsl:when>
  4437. <xsl:otherwise>
  4438. <!-- Close start tag -->
  4439. <xsl:text>> </xsl:text>
  4440. <xsl:if test="$element and local-name($element/..)!='schema'">
  4441. <!-- Occurrence info -->
  4442. <xsl:text> </xsl:text>
  4443. <xsl:call-template name="PrintOccurs">
  4444. <xsl:with-param name="component" select="$element"/>
  4445. </xsl:call-template>
  4446. <!-- Documentation -->
  4447. <xsl:text> </xsl:text>
  4448. <xsl:call-template name="PrintSampleDocumentation">
  4449. <xsl:with-param name="component" select="$element"/>
  4450. </xsl:call-template>
  4451. </xsl:if>
  4452. <!-- Identity Constraints -->
  4453. <xsl:if test="$element">
  4454. <xsl:apply-templates select="$element/xsd:unique | $element/xsd:key | $element/xsd:keyref" mode="sample">
  4455. <xsl:with-param name="margin" select="$ELEM_INDENT"/>
  4456. </xsl:apply-templates>
  4457. </xsl:if>
  4458. <!-- Print out restriction/extension information -->
  4459. <xsl:choose>
  4460. <xsl:when test="false()">
  4461. <!--<xsl:when test="$type/xsd:complexContent/xsd:restriction/@base">-->
  4462. <br/><span class="other" style="margin-left: {$ELEM_INDENT}em">
  4463. <xsl:text>&lt;!-- Restricts : </xsl:text>
  4464. <xsl:call-template name="PrintTypeRef">
  4465. <xsl:with-param name="ref" select="$type/xsd:complexContent/xsd:restriction/@base"/>
  4466. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4467. </xsl:call-template>
  4468. <xsl:text> --></xsl:text>
  4469. </span>
  4470. </xsl:when>
  4471. <xsl:when test="false()">
  4472. <!--<xsl:when test="$type/xsd:complexContent/xsd:extension/@base">-->
  4473. <br/><span class="other" style="margin-left: {$ELEM_INDENT}em">
  4474. <xsl:text>&lt;!-- Extends : </xsl:text>
  4475. <xsl:call-template name="PrintTypeRef">
  4476. <xsl:with-param name="ref" select="$type/xsd:complexContent/xsd:extension/@base"/>
  4477. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4478. </xsl:call-template>
  4479. <xsl:text> --></xsl:text>
  4480. </span>
  4481. </xsl:when>
  4482. </xsl:choose>
  4483. <!-- Print out message if has mixed content -->
  4484. <xsl:if test="$mixed='true'">
  4485. <br/><span class="other" style="margin-left: {$ELEM_INDENT}em">
  4486. <xsl:text>&lt;!-- Mixed content --></xsl:text>
  4487. </span>
  4488. </xsl:if>
  4489. <!-- Element Content -->
  4490. <xsl:copy-of select="$content"/>
  4491. <!-- End Tag -->
  4492. <xsl:text>&lt;/</xsl:text>
  4493. <xsl:copy-of select="$tag"/>
  4494. <xsl:text>></xsl:text>
  4495. </xsl:otherwise>
  4496. </xsl:choose>
  4497. </div>
  4498. </xsl:otherwise>
  4499. </xsl:choose>
  4500. </xsl:template>
  4501. <!--
  4502. Prints out attributes of a complex type definition, including
  4503. those inherited from a base type.
  4504. Param(s):
  4505. type (Node) required
  4506. Complex type definition
  4507. subTypeAttrs (String) optional
  4508. List of attributes in sub-types of this current type
  4509. definition
  4510. isInherited (boolean) optional
  4511. If true, display attributes using 'inherited' CSS class.
  4512. isNewField (boolean) optional
  4513. If true, display attributes using 'newFields' CSS class.
  4514. fromTopCType (boolean) optional
  4515. Set to true if this is being displayed in the XML
  4516. Instance Representation table of a top-level complex
  4517. type definition, in which case, 'inherited' attributes
  4518. and elements are distinguished.
  4519. margin (nonNegativeInteger) optional
  4520. Number of 'em' to indent from left
  4521. schemaLoc (String) optional
  4522. Schema file containing this complex type definition;
  4523. if in current schema, 'schemaLoc' is set to 'this'.
  4524. typeList (String) optional
  4525. List of types in this call chain. Name of type starts
  4526. with '*', and ends with '+'. (Used to prevent infinite
  4527. recursive loop.)
  4528. -->
  4529. <xsl:template name="PrintSampleTypeAttrs">
  4530. <xsl:param name="type"/>
  4531. <xsl:param name="subTypeAttrs"/>
  4532. <xsl:param name="isInherited">false</xsl:param>
  4533. <xsl:param name="isNewField">false</xsl:param>
  4534. <xsl:param name="fromTopCType">false</xsl:param>
  4535. <xsl:param name="margin">0</xsl:param>
  4536. <xsl:param name="schemaLoc">this</xsl:param>
  4537. <xsl:param name="typeList"/>
  4538. <xsl:choose>
  4539. <!-- Circular type hierarchy -->
  4540. <xsl:when test="$type/@name and contains($typeList, concat('*', $type/@name, '+'))">
  4541. <!-- Do nothing.
  4542. Error message will be written out by 'PrintSampleTypeContent' template.
  4543. -->
  4544. </xsl:when>
  4545. <!-- Derivation -->
  4546. <xsl:when test="$type/xsd:complexContent or $type/xsd:simpleContent">
  4547. <xsl:choose>
  4548. <xsl:when test="$type/xsd:complexContent/xsd:restriction">
  4549. <xsl:call-template name="PrintSampleDerivedTypeAttrs">
  4550. <xsl:with-param name="derivationElem" select="$type/xsd:complexContent/xsd:restriction"/>
  4551. <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
  4552. <xsl:with-param name="isInherited" select="$isInherited"/>
  4553. <xsl:with-param name="isNewField" select="$isNewField"/>
  4554. <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
  4555. <xsl:with-param name="margin" select="$margin"/>
  4556. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4557. <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
  4558. </xsl:call-template>
  4559. </xsl:when>
  4560. <xsl:when test="$type/xsd:simpleContent/xsd:restriction">
  4561. <xsl:call-template name="PrintSampleDerivedTypeAttrs">
  4562. <xsl:with-param name="derivationElem" select="$type/xsd:simpleContent/xsd:restriction"/>
  4563. <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
  4564. <xsl:with-param name="isInherited" select="$isInherited"/>
  4565. <xsl:with-param name="isNewField" select="$isNewField"/>
  4566. <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
  4567. <xsl:with-param name="margin" select="$margin"/>
  4568. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4569. <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
  4570. </xsl:call-template>
  4571. </xsl:when>
  4572. <xsl:when test="$type/xsd:complexContent/xsd:extension">
  4573. <xsl:call-template name="PrintSampleDerivedTypeAttrs">
  4574. <xsl:with-param name="derivationElem" select="$type/xsd:complexContent/xsd:extension"/>
  4575. <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
  4576. <xsl:with-param name="isInherited" select="$isInherited"/>
  4577. <xsl:with-param name="isNewField" select="$isNewField"/>
  4578. <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
  4579. <xsl:with-param name="margin" select="$margin"/>
  4580. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4581. <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
  4582. </xsl:call-template>
  4583. </xsl:when>
  4584. <xsl:when test="$type/xsd:simpleContent/xsd:extension">
  4585. <xsl:call-template name="PrintSampleDerivedTypeAttrs">
  4586. <xsl:with-param name="derivationElem" select="$type/xsd:simpleContent/xsd:extension"/>
  4587. <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
  4588. <xsl:with-param name="isInherited" select="$isInherited"/>
  4589. <xsl:with-param name="isNewField" select="$isNewField"/>
  4590. <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
  4591. <xsl:with-param name="margin" select="$margin"/>
  4592. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4593. <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
  4594. </xsl:call-template>
  4595. </xsl:when>
  4596. </xsl:choose>
  4597. </xsl:when>
  4598. <!-- No derivation -->
  4599. <xsl:when test="local-name($type)='complexType'">
  4600. <xsl:call-template name="PrintSampleAttrList">
  4601. <xsl:with-param name="list" select="$type"/>
  4602. <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
  4603. <xsl:with-param name="isInherited" select="$isInherited"/>
  4604. <xsl:with-param name="isNewField" select="$isNewField"/>
  4605. <xsl:with-param name="margin" select="$margin"/>
  4606. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4607. <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
  4608. </xsl:call-template>
  4609. </xsl:when>
  4610. <!-- Ignore base types that are simple types -->
  4611. </xsl:choose>
  4612. </xsl:template>
  4613. <!--
  4614. Helper function 'PrintSampleTypeAttrs' template to
  4615. handle case of derived types.
  4616. Param(s):
  4617. derivationElem (Node) required
  4618. 'restriction' or 'extension' element
  4619. subTypeAttrs (String) optional
  4620. List of attributes in sub-types of
  4621. this current type definition
  4622. isInherited (boolean) optional
  4623. If true, display attributes using 'inherited' CSS class.
  4624. isNewField (boolean) optional
  4625. If true, display attributes using 'newFields' CSS class.
  4626. fromTopCType (boolean) optional
  4627. Set to true if this is being displayed
  4628. in the XML Instance Representation table
  4629. of a top-level complex type definition, in
  4630. which case, 'inherited' attributes and
  4631. elements are distinguished.
  4632. margin (nonNegativeInteger) optional
  4633. Number of 'em' to indent from left
  4634. schemaLoc (String) optional
  4635. Schema file containing this derivation element;
  4636. if in current schema, 'schemaLoc' is set to 'this'.
  4637. typeList (String) optional
  4638. List of types in this call chain. Name of type starts
  4639. with '*', and ends with '+'. (Used to prevent infinite
  4640. recursive loop.)
  4641. -->
  4642. <xsl:template name="PrintSampleDerivedTypeAttrs">
  4643. <xsl:param name="derivationElem"/>
  4644. <xsl:param name="subTypeAttrs"/>
  4645. <xsl:param name="isInherited">false</xsl:param>
  4646. <xsl:param name="isNewField">false</xsl:param>
  4647. <xsl:param name="fromTopCType">false</xsl:param>
  4648. <xsl:param name="margin">0</xsl:param>
  4649. <xsl:param name="schemaLoc">this</xsl:param>
  4650. <xsl:param name="typeList"/>
  4651. <!-- Get attributes from this type to add to
  4652. 'subTypeAttrs' list for recursive call on base type -->
  4653. <xsl:variable name="thisAttrs">
  4654. <xsl:call-template name="GetAttrList">
  4655. <xsl:with-param name="list" select="$derivationElem"/>
  4656. </xsl:call-template>
  4657. </xsl:variable>
  4658. <!-- Look for base type -->
  4659. <xsl:variable name="baseTypeName">
  4660. <xsl:call-template name="GetRefName">
  4661. <xsl:with-param name="ref" select="$derivationElem/@base"/>
  4662. </xsl:call-template>
  4663. </xsl:variable>
  4664. <xsl:variable name="defLoc">
  4665. <xsl:call-template name="FindComponent">
  4666. <xsl:with-param name="ref" select="$derivationElem/@base"/>
  4667. <xsl:with-param name="compType">complex type</xsl:with-param>
  4668. </xsl:call-template>
  4669. </xsl:variable>
  4670. <xsl:choose>
  4671. <!-- Complex type was found in current schema. -->
  4672. <xsl:when test="normalize-space($defLoc)='this'">
  4673. <xsl:variable name="ctype" select="key('complexType', $baseTypeName)"/>
  4674. <xsl:call-template name="PrintSampleTypeAttrs">
  4675. <xsl:with-param name="type" select="$ctype"/>
  4676. <xsl:with-param name="subTypeAttrs" select="concat($subTypeAttrs, $thisAttrs)"/>
  4677. <xsl:with-param name="isInherited">
  4678. <xsl:choose>
  4679. <xsl:when test="$fromTopCType!='false'">
  4680. <xsl:text>true</xsl:text>
  4681. </xsl:when>
  4682. <xsl:otherwise>
  4683. <xsl:text>false</xsl:text>
  4684. </xsl:otherwise>
  4685. </xsl:choose>
  4686. </xsl:with-param>
  4687. <xsl:with-param name="isNewField" select="$isNewField"/>
  4688. <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
  4689. <xsl:with-param name="margin" select="$margin"/>
  4690. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4691. <xsl:with-param name="typeList" select="$typeList"/>
  4692. </xsl:call-template>
  4693. </xsl:when>
  4694. <!-- Complex type was not found. -->
  4695. <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">
  4696. <!-- IGNORE: Error message will be printed out be
  4697. 'PrintSampleTypeContent' template. -->
  4698. </xsl:when>
  4699. <!-- Complex type was found in external schema. -->
  4700. <xsl:otherwise>
  4701. <xsl:variable name="ctype" select="document($defLoc)/xsd:schema/xsd:complexType[@name=$baseTypeName]"/>
  4702. <xsl:call-template name="PrintSampleTypeAttrs">
  4703. <xsl:with-param name="type" select="$ctype"/>
  4704. <xsl:with-param name="subTypeAttrs" select="concat($subTypeAttrs, $thisAttrs)"/>
  4705. <xsl:with-param name="isInherited">
  4706. <xsl:choose>
  4707. <xsl:when test="$fromTopCType!='false'">
  4708. <xsl:text>true</xsl:text>
  4709. </xsl:when>
  4710. <xsl:otherwise>
  4711. <xsl:text>false</xsl:text>
  4712. </xsl:otherwise>
  4713. </xsl:choose>
  4714. </xsl:with-param>
  4715. <xsl:with-param name="isNewField" select="$isNewField"/>
  4716. <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
  4717. <xsl:with-param name="margin" select="$margin"/>
  4718. <xsl:with-param name="schemaLoc" select="$defLoc"/>
  4719. <xsl:with-param name="typeList" select="$typeList"/>
  4720. </xsl:call-template>
  4721. </xsl:otherwise>
  4722. </xsl:choose>
  4723. <!-- Print out attributes in this type -->
  4724. <xsl:call-template name="PrintSampleAttrList">
  4725. <xsl:with-param name="list" select="$derivationElem"/>
  4726. <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
  4727. <xsl:with-param name="isInherited" select="$isInherited"/>
  4728. <xsl:with-param name="isNewField">
  4729. <xsl:choose>
  4730. <xsl:when test="$fromTopCType!='false' and $isInherited='false'">
  4731. <xsl:text>true</xsl:text>
  4732. </xsl:when>
  4733. <xsl:otherwise>
  4734. <xsl:text>false</xsl:text>
  4735. </xsl:otherwise>
  4736. </xsl:choose>
  4737. </xsl:with-param>
  4738. <xsl:with-param name="margin" select="$margin"/>
  4739. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4740. </xsl:call-template>
  4741. </xsl:template>
  4742. <!--
  4743. Returns the names and namespaces of attributes
  4744. in a list of attributes and attribute groups.
  4745. Param(s):
  4746. list (Node) required
  4747. Node containing list of attributes and attribute groups
  4748. -->
  4749. <xsl:template name="GetAttrList">
  4750. <xsl:param name="list"/>
  4751. <xsl:if test="$list">
  4752. <xsl:for-each select="$list/xsd:attribute | $list/xsd:attributeGroup | $list/xsd:anyAttribute">
  4753. <xsl:choose>
  4754. <!-- Attribute declaration -->
  4755. <xsl:when test="local-name(.)='attribute' and @name">
  4756. <!-- Get attribute name -->
  4757. <xsl:variable name="attrName" select="@name"/>
  4758. <!-- Get attribute namespace -->
  4759. <xsl:variable name="attrNS">
  4760. <xsl:call-template name="GetAttributeNS">
  4761. <xsl:with-param name="attribute" select="."/>
  4762. </xsl:call-template>
  4763. </xsl:variable>
  4764. <xsl:value-of select="concat('*', normalize-space($attrNS), '+', normalize-space($attrName), '+')"/>
  4765. </xsl:when>
  4766. <!-- Attribute reference -->
  4767. <xsl:when test="local-name(.)='attribute' and @ref">
  4768. <!-- Get attribute name -->
  4769. <xsl:variable name="attrName">
  4770. <xsl:call-template name="GetRefName">
  4771. <xsl:with-param name="ref" select="@ref"/>
  4772. </xsl:call-template>
  4773. </xsl:variable>
  4774. <!-- Get attribute namespace -->
  4775. <xsl:variable name="attrNS">
  4776. <xsl:call-template name="GetAttributeNS">
  4777. <xsl:with-param name="attribute" select="."/>
  4778. </xsl:call-template>
  4779. </xsl:variable>
  4780. <xsl:value-of select="concat('*', normalize-space($attrNS), '+', normalize-space($attrName), '+')"/>
  4781. </xsl:when>
  4782. <!-- Attribute Group reference -->
  4783. <xsl:when test="local-name(.)='attributeGroup' and @ref">
  4784. <xsl:variable name="attrGrpName">
  4785. <xsl:call-template name="GetRefName">
  4786. <xsl:with-param name="ref" select="@ref"/>
  4787. </xsl:call-template>
  4788. </xsl:variable>
  4789. <xsl:call-template name="GetAttrList">
  4790. <xsl:with-param name="list" select="key('attributeGroup', $attrGrpName)"/>
  4791. </xsl:call-template>
  4792. </xsl:when>
  4793. <!-- Attribute wildcard -->
  4794. <xsl:when test="local-name(.)='anyAttribute'">
  4795. </xsl:when>
  4796. </xsl:choose>
  4797. </xsl:for-each>
  4798. </xsl:if>
  4799. </xsl:template>
  4800. <!--
  4801. Prints out sample XML instances from a list of attributes and
  4802. attribute groups.
  4803. Param(s):
  4804. list (Node) required
  4805. Node containing list of attributes and attribute groups
  4806. subTypeAttrs (String) optional
  4807. List of attributes in sub-types of
  4808. the type definition containing this list
  4809. isInherited (boolean) optional
  4810. If true, display attributes using 'inherited' CSS class.
  4811. isNewField (boolean) optional
  4812. If true, display attributes using 'newFields' CSS class.
  4813. margin (nonNegativeInteger) optional
  4814. Number of 'em' to indent from left
  4815. schemaLoc (String) optional
  4816. Schema file containing this attribute list;
  4817. if in current schema, 'schemaLoc' is set to 'this'.
  4818. -->
  4819. <xsl:template name="PrintSampleAttrList">
  4820. <xsl:param name="list"/>
  4821. <xsl:param name="subTypeAttrs"/>
  4822. <xsl:param name="isInherited">false</xsl:param>
  4823. <xsl:param name="isNewField">false</xsl:param>
  4824. <xsl:param name="margin">0</xsl:param>
  4825. <xsl:param name="schemaLoc">this</xsl:param>
  4826. <xsl:apply-templates select="$list/xsd:attribute | $list/xsd:attributeGroup | $list/xsd:anyAttribute" mode="sample">
  4827. <xsl:with-param name="subTypeAttrs" select="$subTypeAttrs"/>
  4828. <xsl:with-param name="isInherited" select="$isInherited"/>
  4829. <xsl:with-param name="isNewField" select="$isNewField"/>
  4830. <xsl:with-param name="margin" select="$margin"/>
  4831. <xsl:with-param name="addBR">true</xsl:with-param>
  4832. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4833. </xsl:apply-templates>
  4834. </xsl:template>
  4835. <!--
  4836. Prints out the element content of a complex type definition,
  4837. including those inherited from a base type.
  4838. Param(s):
  4839. type (Node) required
  4840. Complex type definition
  4841. margin (nonNegativeInteger) optional
  4842. Number of 'em' to indent from left
  4843. isInherited (boolean) optional
  4844. If true, display elements using 'inherited' CSS class.
  4845. isNewField (boolean) optional
  4846. If true, display elements using 'newFields' CSS class.
  4847. fromTopCType (boolean) optional
  4848. Set to true if this is being displayed in the XML
  4849. Instance Representation table of a top-level complex
  4850. type definition, in which case, 'inherited' attributes
  4851. and elements are distinguished.
  4852. addBR (boolean) optional
  4853. If true, can add <br/> before element content.
  4854. Applicable only if displaying complex content.
  4855. schemaLoc (String) optional
  4856. Schema file containing this type definition;
  4857. if in current schema, 'schemaLoc' is set to 'this'.
  4858. typeList (String) optional
  4859. List of types in this call chain. Name of type starts
  4860. with '*', and ends with '+'. (Used to prevent infinite
  4861. recursive loop.)
  4862. -->
  4863. <xsl:template name="PrintSampleTypeContent">
  4864. <xsl:param name="type"/>
  4865. <xsl:param name="margin">0</xsl:param>
  4866. <xsl:param name="isInherited">false</xsl:param>
  4867. <xsl:param name="isNewField">false</xsl:param>
  4868. <xsl:param name="fromTopCType">false</xsl:param>
  4869. <xsl:param name="addBR">true</xsl:param>
  4870. <xsl:param name="schemaLoc">this</xsl:param>
  4871. <xsl:param name="typeList"/>
  4872. <xsl:param name="parentGroups"/>
  4873. <xsl:if test="$addBR='true'"><br/></xsl:if>
  4874. <xsl:choose>
  4875. <!-- Circular type hierarchy -->
  4876. <xsl:when test="$type/@name and contains($typeList, concat('*', $type/@name, '+'))"/>
  4877. <!-- Derivation by restriction on complex content -->
  4878. <xsl:when test="$type/xsd:complexContent/xsd:restriction">
  4879. <xsl:variable name="restriction" select="$type/xsd:complexContent/xsd:restriction"/>
  4880. <!-- Test if base type is in schema to print out warning comment-->
  4881. <xsl:variable name="baseTypeName">
  4882. <xsl:call-template name="GetRefName">
  4883. <xsl:with-param name="ref" select="$restriction/@base"/>
  4884. </xsl:call-template>
  4885. </xsl:variable>
  4886. <!-- Look for base type -->
  4887. <xsl:variable name="defLoc">
  4888. <xsl:call-template name="FindComponent">
  4889. <xsl:with-param name="ref" select="$restriction/@base"/>
  4890. <xsl:with-param name="compType">complex type</xsl:with-param>
  4891. </xsl:call-template>
  4892. </xsl:variable>
  4893. <xsl:choose>
  4894. <!-- Complex type was not found. -->
  4895. <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">
  4896. <div class="other" style="margin-left: {$margin}em;">
  4897. <xsl:text>&lt;!-- '</xsl:text>
  4898. <xsl:call-template name="PrintTypeRef">
  4899. <xsl:with-param name="ref" select="$restriction/@base"/>
  4900. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4901. </xsl:call-template>
  4902. <xsl:text>' super type was not found in this schema. Some elements and attributes may be missing. --></xsl:text>
  4903. </div>
  4904. </xsl:when>
  4905. <!-- Complex type was found. -->
  4906. <xsl:otherwise>
  4907. <!-- IGNORE element content of base type if by restriction,
  4908. since current content will override restricted
  4909. base type's content. -->
  4910. </xsl:otherwise>
  4911. </xsl:choose>
  4912. <!-- Print out content from this type -->
  4913. <xsl:if test="$restriction/xsd:*[local-name(.)!='annotation']">
  4914. <xsl:call-template name="PrintSampleParticleList">
  4915. <xsl:with-param name="list" select="$restriction"/>
  4916. <xsl:with-param name="margin" select="$margin"/>
  4917. <xsl:with-param name="isInherited" select="$isInherited"/>
  4918. <xsl:with-param name="isNewField">
  4919. <xsl:choose>
  4920. <xsl:when test="$fromTopCType!='false' and $isInherited='false'">
  4921. <xsl:text>true</xsl:text>
  4922. </xsl:when>
  4923. <xsl:otherwise>
  4924. <xsl:text>false</xsl:text>
  4925. </xsl:otherwise>
  4926. </xsl:choose>
  4927. </xsl:with-param>
  4928. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4929. <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
  4930. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  4931. </xsl:call-template>
  4932. </xsl:if>
  4933. </xsl:when>
  4934. <!-- Derivation by extension on complex content -->
  4935. <xsl:when test="$type/xsd:complexContent/xsd:extension">
  4936. <xsl:variable name="extension" select="$type/xsd:complexContent/xsd:extension"/>
  4937. <xsl:variable name="baseTypeName">
  4938. <xsl:call-template name="GetRefName">
  4939. <xsl:with-param name="ref" select="$extension/@base"/>
  4940. </xsl:call-template>
  4941. </xsl:variable>
  4942. <xsl:choose>
  4943. <xsl:when test="contains($typeList, concat('*', $baseTypeName, '+'))">
  4944. <div class="other" style="margin-left: {$margin}em">
  4945. <xsl:text>&lt;-- Extends: </xsl:text>
  4946. <xsl:call-template name="PrintTypeRef">
  4947. <xsl:with-param name="ref" select="$extension/@base"/>
  4948. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4949. </xsl:call-template>
  4950. <xsl:text> (Circular type hierarchy) --&gt;</xsl:text>
  4951. </div>
  4952. </xsl:when>
  4953. <xsl:otherwise>
  4954. <!-- Look for base type -->
  4955. <xsl:variable name="defLoc">
  4956. <xsl:call-template name="FindComponent">
  4957. <xsl:with-param name="ref" select="$extension/@base"/>
  4958. <xsl:with-param name="compType">complex type</xsl:with-param>
  4959. </xsl:call-template>
  4960. </xsl:variable>
  4961. <xsl:choose>
  4962. <!-- Complex type was found in current schema. -->
  4963. <xsl:when test="normalize-space($defLoc)='this'">
  4964. <xsl:variable name="ctype" select="key('complexType', $baseTypeName)"/>
  4965. <xsl:call-template name="PrintSampleTypeContent">
  4966. <xsl:with-param name="type" select="$ctype"/>
  4967. <xsl:with-param name="margin" select="$margin"/>
  4968. <xsl:with-param name="isInherited">
  4969. <xsl:choose>
  4970. <xsl:when test="$fromTopCType!='false'">
  4971. <xsl:text>true</xsl:text>
  4972. </xsl:when>
  4973. <xsl:otherwise>
  4974. <xsl:text>false</xsl:text>
  4975. </xsl:otherwise>
  4976. </xsl:choose>
  4977. </xsl:with-param>
  4978. <xsl:with-param name="isNewField" select="$isNewField"/>
  4979. <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
  4980. <xsl:with-param name="addBR">false</xsl:with-param>
  4981. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4982. <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
  4983. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  4984. </xsl:call-template>
  4985. </xsl:when>
  4986. <!-- Complex type was not found. -->
  4987. <xsl:when test="normalize-space($defLoc)='' or normalize-space($defLoc)='none' or normalize-space($defLoc)='xml' or normalize-space($defLoc)='xsd'">
  4988. <div class="other" style="margin-left: {$margin}em;">
  4989. <xsl:text>&lt;!-- '</xsl:text>
  4990. <xsl:call-template name="PrintTypeRef">
  4991. <xsl:with-param name="ref" select="$extension/@base"/>
  4992. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  4993. </xsl:call-template>
  4994. <xsl:text>' super type was not found in this schema. Some elements and attributes may be missing. --></xsl:text>
  4995. </div>
  4996. </xsl:when>
  4997. <!-- Complex type was found in external schema. -->
  4998. <xsl:otherwise>
  4999. <xsl:variable name="ctype" select="document($defLoc)/xsd:schema/xsd:complexType[@name=$baseTypeName]"/>
  5000. <xsl:call-template name="PrintSampleTypeContent">
  5001. <xsl:with-param name="type" select="$ctype"/>
  5002. <xsl:with-param name="margin" select="$margin"/>
  5003. <xsl:with-param name="isInherited">
  5004. <xsl:choose>
  5005. <xsl:when test="$fromTopCType!='false'">
  5006. <xsl:text>true</xsl:text>
  5007. </xsl:when>
  5008. <xsl:otherwise>
  5009. <xsl:text>false</xsl:text>
  5010. </xsl:otherwise>
  5011. </xsl:choose>
  5012. </xsl:with-param>
  5013. <xsl:with-param name="isNewField" select="$isNewField"/>
  5014. <xsl:with-param name="fromTopCType" select="$fromTopCType"/>
  5015. <xsl:with-param name="addBR">false</xsl:with-param>
  5016. <xsl:with-param name="schemaLoc" select="$defLoc"/>
  5017. <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
  5018. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  5019. </xsl:call-template>
  5020. </xsl:otherwise>
  5021. </xsl:choose>
  5022. <!-- Print out content from this type -->
  5023. <xsl:if test="$extension/xsd:*[local-name(.)!='annotation']">
  5024. <xsl:call-template name="PrintSampleParticleList">
  5025. <xsl:with-param name="list" select="$extension"/>
  5026. <xsl:with-param name="margin" select="$margin"/>
  5027. <xsl:with-param name="isInherited" select="$isInherited"/>
  5028. <xsl:with-param name="isNewField">
  5029. <xsl:choose>
  5030. <xsl:when test="$fromTopCType!='false' and $isInherited='false'">
  5031. <xsl:text>true</xsl:text>
  5032. </xsl:when>
  5033. <xsl:otherwise>
  5034. <xsl:text>false</xsl:text>
  5035. </xsl:otherwise>
  5036. </xsl:choose>
  5037. </xsl:with-param>
  5038. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5039. <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
  5040. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  5041. </xsl:call-template>
  5042. </xsl:if>
  5043. </xsl:otherwise>
  5044. </xsl:choose>
  5045. </xsl:when>
  5046. <!-- Derivation by restriction on simple content -->
  5047. <xsl:when test="$type/xsd:simpleContent/xsd:restriction">
  5048. <!-- Print out simple type constraints-->
  5049. <span style="margin-left: {$margin}em">
  5050. <xsl:text> </xsl:text>
  5051. <xsl:apply-templates select="$type/xsd:simpleContent" mode="sample">
  5052. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5053. </xsl:apply-templates>
  5054. <xsl:text> </xsl:text>
  5055. </span><br/>
  5056. </xsl:when>
  5057. <!-- Derivation by extension on simple content -->
  5058. <xsl:when test="$type/xsd:simpleContent/xsd:extension">
  5059. <!-- Print out base type name -->
  5060. <span style="margin-left: {$margin}em">
  5061. <xsl:text> </xsl:text>
  5062. <xsl:call-template name="PrintTypeRef">
  5063. <xsl:with-param name="ref" select="$type/xsd:simpleContent/xsd:extension/@base"/>
  5064. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5065. </xsl:call-template>
  5066. <xsl:text> </xsl:text>
  5067. </span><br/>
  5068. </xsl:when>
  5069. <!-- No derivation: complex type definition -->
  5070. <xsl:when test="local-name($type)='complexType'">
  5071. <!-- Print out content from this type -->
  5072. <xsl:call-template name="PrintSampleParticleList">
  5073. <xsl:with-param name="list" select="$type"/>
  5074. <xsl:with-param name="margin" select="$margin"/>
  5075. <xsl:with-param name="isInherited" select="$isInherited"/>
  5076. <xsl:with-param name="isNewField" select="$isNewField"/>
  5077. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5078. <xsl:with-param name="typeList" select="concat($typeList, '*', $type/@name, '+')"/>
  5079. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  5080. </xsl:call-template>
  5081. </xsl:when>
  5082. </xsl:choose>
  5083. </xsl:template>
  5084. <!--
  5085. Prints out sample XML instances from a list of
  5086. element particle.
  5087. Param(s):
  5088. list (Node) required
  5089. Node containing list of element particles
  5090. margin (nonNegativeInteger) optional
  5091. Number of 'em' to indent from left
  5092. isInherited (boolean) optional
  5093. If true, display elements using 'inherited' CSS class.
  5094. isNewField (boolean) optional
  5095. If true, display elements using 'newFields' CSS class.
  5096. schemaLoc (String) optional
  5097. Schema file containing this particle list;
  5098. if in current schema, 'schemaLoc' is set to 'this'.
  5099. typeList (String) optional
  5100. List of types in this call chain. Name of type starts
  5101. with '*', and ends with '+'. (Used to prevent infinite
  5102. recursive loop.)
  5103. -->
  5104. <xsl:template name="PrintSampleParticleList">
  5105. <xsl:param name="list"/>
  5106. <xsl:param name="margin">0</xsl:param>
  5107. <xsl:param name="isInherited">false</xsl:param>
  5108. <xsl:param name="isNewField">false</xsl:param>
  5109. <xsl:param name="schemaLoc">this</xsl:param>
  5110. <xsl:param name="typeList"/>
  5111. <xsl:param name="parentGroups"/>
  5112. <xsl:if test="$list">
  5113. <xsl:apply-templates select="$list/xsd:group | $list/xsd:sequence | $list/xsd:choice | $list/xsd:all | $list/xsd:element" mode="sample">
  5114. <xsl:with-param name="margin" select="$margin"/>
  5115. <xsl:with-param name="isInherited" select="$isInherited"/>
  5116. <xsl:with-param name="isNewField" select="$isNewField"/>
  5117. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5118. <xsl:with-param name="typeList" select="$typeList"/>
  5119. <xsl:with-param name="parentGroups" select="$parentGroups"/>
  5120. </xsl:apply-templates>
  5121. </xsl:if>
  5122. </xsl:template>
  5123. <!--
  5124. Prints out the constraints of simple content
  5125. to be displayed within a sample XML instance.
  5126. Param(s):
  5127. simpleContent (Node) required
  5128. Node containing with the simple content
  5129. schemaLoc (String) optional
  5130. Schema file containing these simple constraints;
  5131. if in current schema, 'schemaLoc' is set to 'this'.
  5132. -->
  5133. <xsl:template name="PrintSampleSimpleConstraints">
  5134. <xsl:param name="simpleContent"/>
  5135. <xsl:param name="schemaLoc">this</xsl:param>
  5136. <xsl:param name="typeList"/>
  5137. <xsl:choose>
  5138. <!-- Derivation by restriction -->
  5139. <xsl:when test="$simpleContent/xsd:restriction">
  5140. <xsl:call-template name="PrintSampleSimpleRestriction">
  5141. <xsl:with-param name="restriction" select="$simpleContent/xsd:restriction"/>
  5142. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5143. <xsl:with-param name="typeList" select="$typeList"/>
  5144. </xsl:call-template>
  5145. </xsl:when>
  5146. <!-- Derivation by list -->
  5147. <xsl:when test="$simpleContent/xsd:list">
  5148. <xsl:choose>
  5149. <xsl:when test="$simpleContent/xsd:list/@itemType">
  5150. <xsl:text>list of: </xsl:text>
  5151. <xsl:call-template name="PrintTypeRef">
  5152. <xsl:with-param name="ref" select="$simpleContent/xsd:list/@itemType"/>
  5153. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5154. </xsl:call-template>
  5155. </xsl:when>
  5156. <xsl:otherwise>
  5157. <xsl:text>list of: [ </xsl:text>
  5158. <xsl:call-template name="PrintSampleSimpleConstraints">
  5159. <xsl:with-param name="simpleContent" select="$simpleContent/xsd:list/xsd:simpleType"/>
  5160. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5161. </xsl:call-template>
  5162. <xsl:text> ]</xsl:text>
  5163. </xsl:otherwise>
  5164. </xsl:choose>
  5165. </xsl:when>
  5166. <!-- Derivation by union -->
  5167. <xsl:when test="$simpleContent/xsd:union">
  5168. <xsl:text>union of: [ </xsl:text>
  5169. <xsl:variable name="hasMemberTypes">
  5170. <xsl:if test="normalize-space($simpleContent/xsd:union/@memberTypes)!=''">
  5171. <xsl:text>true</xsl:text>
  5172. </xsl:if>
  5173. </xsl:variable>
  5174. <xsl:if test="$hasMemberTypes='true'">
  5175. <xsl:call-template name="PrintWhitespaceList">
  5176. <xsl:with-param name="value" select="$simpleContent/xsd:union/@memberTypes"/>
  5177. <xsl:with-param name="compType">type</xsl:with-param>
  5178. <xsl:with-param name="separator">,</xsl:with-param>
  5179. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5180. </xsl:call-template>
  5181. </xsl:if>
  5182. <xsl:for-each select="$simpleContent/xsd:union/xsd:simpleType">
  5183. <xsl:if test="position()!=1 or $hasMemberTypes='true'">
  5184. <xsl:text>, </xsl:text>
  5185. </xsl:if>
  5186. <xsl:text>[ </xsl:text>
  5187. <xsl:call-template name="PrintSampleSimpleConstraints">
  5188. <xsl:with-param name="simpleContent" select="."/>
  5189. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5190. </xsl:call-template>
  5191. <xsl:text> ]</xsl:text>
  5192. </xsl:for-each>
  5193. <xsl:text> ]</xsl:text>
  5194. </xsl:when>
  5195. </xsl:choose>
  5196. </xsl:template>
  5197. <!--
  5198. Prints out the constraints of simple content
  5199. derived by restriction, which is to be displayed
  5200. within a sample XML instance.
  5201. Param(s):
  5202. restriction (Node) required
  5203. Node containing with the restriction
  5204. schemaLoc (String) optional
  5205. Schema file containing this restriction element;
  5206. if in current schema, 'schemaLoc' is set to 'this'.
  5207. -->
  5208. <xsl:template name="PrintSampleSimpleRestriction">
  5209. <xsl:param name="restriction"/>
  5210. <xsl:param name="schemaLoc">this</xsl:param>
  5211. <xsl:param name="typeList"/>
  5212. <xsl:variable name="typeName" select="$restriction/parent::xsd:simpleType/@name"/>
  5213. <!-- Print out base type info -->
  5214. <xsl:choose>
  5215. <!-- Circular type hierarchy -->
  5216. <xsl:when test="$typeName != '' and contains($typeList, concat('*', $typeName, '+'))">
  5217. <xsl:call-template name="HandleError">
  5218. <xsl:with-param name="isTerminating">false</xsl:with-param>
  5219. <xsl:with-param name="errorMsg">
  5220. <xsl:text>Circular type reference to '</xsl:text>
  5221. <xsl:value-of select="$typeName"/>
  5222. <xsl:text>' in type hierarchy.</xsl:text>
  5223. </xsl:with-param>
  5224. </xsl:call-template>
  5225. </xsl:when>
  5226. <!-- Locally-defined base type -->
  5227. <xsl:when test="$restriction/xsd:simpleType">
  5228. <xsl:call-template name="PrintSampleSimpleConstraints">
  5229. <xsl:with-param name="simpleContent" select="$restriction/xsd:simpleType"/>
  5230. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5231. <xsl:with-param name="typeList" select="$typeList"/>
  5232. </xsl:call-template>
  5233. </xsl:when>
  5234. <!-- Base type reference -->
  5235. <xsl:when test="$restriction">
  5236. <xsl:variable name="baseTypeRef" select="$restriction/@base"/>
  5237. <xsl:variable name="baseTypeName">
  5238. <xsl:call-template name="GetRefName">
  5239. <xsl:with-param name="ref" select="$baseTypeRef"/>
  5240. </xsl:call-template>
  5241. </xsl:variable>
  5242. <xsl:variable name="baseTypeNS">
  5243. <xsl:call-template name="GetRefNS">
  5244. <xsl:with-param name="ref" select="$baseTypeRef"/>
  5245. </xsl:call-template>
  5246. </xsl:variable>
  5247. <!-- Write out reference to base type -->
  5248. <xsl:call-template name="PrintTypeRef">
  5249. <xsl:with-param name="ref" select="$baseTypeRef"/>
  5250. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  5251. </xsl:call-template>
  5252. </xsl:when>
  5253. </xsl:choose>
  5254. <!-- Regular Expression Pattern -->
  5255. <xsl:variable name="pattern">
  5256. <xsl:call-template name="PrintPatternFacet">
  5257. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  5258. </xsl:call-template>
  5259. </xsl:variable>
  5260. <!-- Range -->
  5261. <xsl:variable name="range">
  5262. <xsl:call-template name="PrintRangeFacets">
  5263. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  5264. </xsl:call-template>
  5265. </xsl:variable>
  5266. <!-- Length -->
  5267. <xsl:variable name="length">
  5268. <xsl:call-template name="PrintLengthFacets">
  5269. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  5270. </xsl:call-template>
  5271. </xsl:variable>
  5272. <!-- Print out facets -->
  5273. <xsl:if test="$restriction/xsd:enumeration">
  5274. <xsl:text> (</xsl:text>
  5275. <xsl:call-template name="PrintEnumFacets">
  5276. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  5277. </xsl:call-template>
  5278. <xsl:text>)</xsl:text>
  5279. </xsl:if>
  5280. <xsl:if test="$pattern !=''">
  5281. <xsl:text> (</xsl:text>
  5282. <xsl:copy-of select="$pattern"/>
  5283. <xsl:text>)</xsl:text>
  5284. </xsl:if>
  5285. <xsl:if test="$range !=''">
  5286. <xsl:text> (</xsl:text>
  5287. <xsl:copy-of select="$range"/>
  5288. <xsl:text>)</xsl:text>
  5289. </xsl:if>
  5290. <xsl:if test="$restriction/xsd:totalDigits">
  5291. <xsl:text> (</xsl:text>
  5292. <xsl:call-template name="PrintTotalDigitsFacet">
  5293. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  5294. </xsl:call-template>
  5295. <xsl:text>)</xsl:text>
  5296. </xsl:if>
  5297. <xsl:if test="$restriction/xsd:fractionDigits">
  5298. <xsl:text> (</xsl:text>
  5299. <xsl:call-template name="PrintFractionDigitsFacet">
  5300. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  5301. </xsl:call-template>
  5302. <xsl:text>)</xsl:text>
  5303. </xsl:if>
  5304. <xsl:if test="$length !=''">
  5305. <xsl:text> (</xsl:text>
  5306. <xsl:copy-of select="$length"/>
  5307. <xsl:text>)</xsl:text>
  5308. </xsl:if>
  5309. <xsl:if test="$restriction/xsd:whiteSpace">
  5310. <xsl:text> (</xsl:text>
  5311. <xsl:call-template name="PrintWhitespaceFacet">
  5312. <xsl:with-param name="simpleRestrict" select="$restriction"/>
  5313. </xsl:call-template>
  5314. <xsl:text>)</xsl:text>
  5315. </xsl:if>
  5316. </xsl:template>
  5317. <!-- ******** Schema Component Representation table ******** -->
  5318. <!--
  5319. Prints out the Schema Component Representation table
  5320. for a top-level schema component.
  5321. Param(s):
  5322. component (Node) required
  5323. Top-level schema component
  5324. -->
  5325. <xsl:template name="SchemaComponentTable">
  5326. <xsl:param name="component"/>
  5327. <xsl:variable name="componentID">
  5328. <xsl:call-template name="GetComponentID">
  5329. <xsl:with-param name="component" select="$component"/>
  5330. </xsl:call-template>
  5331. </xsl:variable>
  5332. <xsl:call-template name="CollapseableBox">
  5333. <xsl:with-param name="id" select="concat($componentID, '_scbox')"/>
  5334. <xsl:with-param name="styleClass">schemaComponent</xsl:with-param>
  5335. <xsl:with-param name="caption">Schema Component Representation</xsl:with-param>
  5336. <xsl:with-param name="contents">
  5337. <xsl:apply-templates select="$component" mode="schemaComponent"/>
  5338. </xsl:with-param>
  5339. <xsl:with-param name="isOpened">false</xsl:with-param>
  5340. </xsl:call-template>
  5341. </xsl:template>
  5342. <!--
  5343. Prints out schema component representation of
  5344. declarations.
  5345. Param(s):
  5346. margin (nonNegativeInteger) optional
  5347. Number of 'em' to indent from left
  5348. -->
  5349. <xsl:template match="xsd:attribute[@name] | xsd:element[@name]" mode="schemaComponent">
  5350. <xsl:param name="margin">0</xsl:param>
  5351. <xsl:call-template name="DisplaySchemaComponent">
  5352. <xsl:with-param name="component" select="."/>
  5353. <xsl:with-param name="margin" select="$margin"/>
  5354. <xsl:with-param name="attributes">
  5355. <!-- Attribute: name -->
  5356. <xsl:call-template name="DisplayAttr">
  5357. <xsl:with-param name="attrName">name</xsl:with-param>
  5358. <xsl:with-param name="attrValue" select="normalize-space(@name)"/>
  5359. </xsl:call-template>
  5360. <!-- Attribute: type -->
  5361. <xsl:if test="@type">
  5362. <xsl:call-template name="DisplayAttr">
  5363. <xsl:with-param name="attrName">type</xsl:with-param>
  5364. <xsl:with-param name="attrValue">
  5365. <xsl:call-template name="PrintTypeRef">
  5366. <xsl:with-param name="ref" select="normalize-space(@type)"/>
  5367. </xsl:call-template>
  5368. </xsl:with-param>
  5369. </xsl:call-template>
  5370. </xsl:if>
  5371. <!-- Other attributes -->
  5372. <xsl:call-template name="DisplayOtherAttributes">
  5373. <xsl:with-param name="component" select="."/>
  5374. <xsl:with-param name="attrsNotToDisplay">*name+*type+</xsl:with-param>
  5375. </xsl:call-template>
  5376. </xsl:with-param>
  5377. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5378. </xsl:call-template>
  5379. </xsl:template>
  5380. <!--
  5381. Prints out schema component representation of
  5382. definitions and key/uniqueness constraints.
  5383. Param(s):
  5384. margin (nonNegativeInteger) optional
  5385. Number of 'em' to indent from left
  5386. -->
  5387. <xsl:template match="xsd:attributeGroup[@name] | xsd:complexType[@name] | xsd:simpleType[@name] | xsd:group[@name] | xsd:key | xsd:unique" mode="schemaComponent">
  5388. <xsl:param name="margin">0</xsl:param>
  5389. <xsl:call-template name="DisplaySchemaComponent">
  5390. <xsl:with-param name="component" select="."/>
  5391. <xsl:with-param name="margin" select="$margin"/>
  5392. <xsl:with-param name="attributes">
  5393. <!-- Attribute: name -->
  5394. <xsl:call-template name="DisplayAttr">
  5395. <xsl:with-param name="attrName">name</xsl:with-param>
  5396. <xsl:with-param name="attrValue" select="normalize-space(@name)"/>
  5397. </xsl:call-template>
  5398. <!-- Other attributes -->
  5399. <xsl:call-template name="DisplayOtherAttributes">
  5400. <xsl:with-param name="component" select="."/>
  5401. <xsl:with-param name="attrsNotToDisplay">*name+</xsl:with-param>
  5402. </xsl:call-template>
  5403. </xsl:with-param>
  5404. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5405. </xsl:call-template>
  5406. </xsl:template>
  5407. <!--
  5408. Prints out schema component representation of attribute
  5409. references.
  5410. Param(s):
  5411. margin (nonNegativeInteger) optional
  5412. Number of 'em' to indent from left
  5413. -->
  5414. <xsl:template match="xsd:attribute[@ref]" mode="schemaComponent">
  5415. <xsl:param name="margin">0</xsl:param>
  5416. <xsl:call-template name="DisplaySchemaComponent">
  5417. <xsl:with-param name="component" select="."/>
  5418. <xsl:with-param name="margin" select="$margin"/>
  5419. <xsl:with-param name="attributes">
  5420. <!-- Attribute: ref -->
  5421. <xsl:call-template name="DisplayAttr">
  5422. <xsl:with-param name="attrName">ref</xsl:with-param>
  5423. <xsl:with-param name="attrValue">
  5424. <xsl:call-template name="PrintAttributeRef">
  5425. <xsl:with-param name="ref" select="normalize-space(@ref)"/>
  5426. </xsl:call-template>
  5427. </xsl:with-param>
  5428. </xsl:call-template>
  5429. <!-- Other attributes -->
  5430. <xsl:call-template name="DisplayOtherAttributes">
  5431. <xsl:with-param name="component" select="."/>
  5432. <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>
  5433. </xsl:call-template>
  5434. </xsl:with-param>
  5435. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5436. </xsl:call-template>
  5437. </xsl:template>
  5438. <!--
  5439. Prints out schema component representation of attribute group
  5440. references.
  5441. Param(s):
  5442. margin (nonNegativeInteger) optional
  5443. Number of 'em' to indent from left
  5444. -->
  5445. <xsl:template match="xsd:attributeGroup[@ref]" mode="schemaComponent">
  5446. <xsl:param name="margin">0</xsl:param>
  5447. <xsl:call-template name="DisplaySchemaComponent">
  5448. <xsl:with-param name="component" select="."/>
  5449. <xsl:with-param name="margin" select="$margin"/>
  5450. <xsl:with-param name="attributes">
  5451. <!-- Attribute: ref -->
  5452. <xsl:call-template name="DisplayAttr">
  5453. <xsl:with-param name="attrName">ref</xsl:with-param>
  5454. <xsl:with-param name="attrValue">
  5455. <xsl:call-template name="PrintAttributeGroupRef">
  5456. <xsl:with-param name="ref" select="normalize-space(@ref)"/>
  5457. </xsl:call-template>
  5458. </xsl:with-param>
  5459. </xsl:call-template>
  5460. <!-- Other attributes -->
  5461. <xsl:call-template name="DisplayOtherAttributes">
  5462. <xsl:with-param name="component" select="."/>
  5463. <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>
  5464. </xsl:call-template>
  5465. </xsl:with-param>
  5466. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5467. </xsl:call-template>
  5468. </xsl:template>
  5469. <!--
  5470. Prints out schema component representation of element
  5471. references.
  5472. Param(s):
  5473. margin (nonNegativeInteger) optional
  5474. Number of 'em' to indent from left
  5475. -->
  5476. <xsl:template match="xsd:element[@ref]" mode="schemaComponent">
  5477. <xsl:param name="margin">0</xsl:param>
  5478. <xsl:call-template name="DisplaySchemaComponent">
  5479. <xsl:with-param name="component" select="."/>
  5480. <xsl:with-param name="margin" select="$margin"/>
  5481. <xsl:with-param name="attributes">
  5482. <!-- Attribute: ref -->
  5483. <xsl:call-template name="DisplayAttr">
  5484. <xsl:with-param name="attrName">ref</xsl:with-param>
  5485. <xsl:with-param name="attrValue">
  5486. <xsl:call-template name="PrintElementRef">
  5487. <xsl:with-param name="ref" select="normalize-space(@ref)"/>
  5488. </xsl:call-template>
  5489. </xsl:with-param>
  5490. </xsl:call-template>
  5491. <!-- Other attributes -->
  5492. <xsl:call-template name="DisplayOtherAttributes">
  5493. <xsl:with-param name="component" select="."/>
  5494. <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>
  5495. </xsl:call-template>
  5496. </xsl:with-param>
  5497. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5498. </xsl:call-template>
  5499. </xsl:template>
  5500. <!--
  5501. Prints out schema component representation of model group
  5502. references.
  5503. Param(s):
  5504. margin (nonNegativeInteger) optional
  5505. Number of 'em' to indent from left
  5506. -->
  5507. <xsl:template match="xsd:group[@ref]" mode="schemaComponent">
  5508. <xsl:param name="margin">0</xsl:param>
  5509. <xsl:call-template name="DisplaySchemaComponent">
  5510. <xsl:with-param name="component" select="."/>
  5511. <xsl:with-param name="margin" select="$margin"/>
  5512. <xsl:with-param name="attributes">
  5513. <!-- Attribute: ref -->
  5514. <xsl:call-template name="DisplayAttr">
  5515. <xsl:with-param name="attrName">ref</xsl:with-param>
  5516. <xsl:with-param name="attrValue">
  5517. <xsl:call-template name="PrintGroupRef">
  5518. <xsl:with-param name="ref" select="normalize-space(@ref)"/>
  5519. </xsl:call-template>
  5520. </xsl:with-param>
  5521. </xsl:call-template>
  5522. <!-- Other attributes -->
  5523. <xsl:call-template name="DisplayOtherAttributes">
  5524. <xsl:with-param name="component" select="."/>
  5525. <xsl:with-param name="attrsNotToDisplay">*ref+</xsl:with-param>
  5526. </xsl:call-template>
  5527. </xsl:with-param>
  5528. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5529. </xsl:call-template>
  5530. </xsl:template>
  5531. <!--
  5532. Prints out schema component representation of
  5533. 'appinfo' and 'documentation' elements.
  5534. Param(s):
  5535. margin (nonNegativeInteger) optional
  5536. Number of 'em' to indent from left
  5537. -->
  5538. <xsl:template match="xsd:appinfo | xsd:documentation" mode="schemaComponent">
  5539. <xsl:param name="margin">0</xsl:param>
  5540. <xsl:call-template name="DisplaySchemaComponent">
  5541. <xsl:with-param name="component" select="."/>
  5542. <xsl:with-param name="margin" select="$margin"/>
  5543. <xsl:with-param name="attributes">
  5544. <!-- Attribute: source -->
  5545. <xsl:if test="@source">
  5546. <xsl:call-template name="DisplayAttr">
  5547. <xsl:with-param name="attrName">source</xsl:with-param>
  5548. <xsl:with-param name="attrValue">
  5549. <xsl:call-template name="PrintURI">
  5550. <xsl:with-param name="uri" select="normalize-space(@source)"/>
  5551. </xsl:call-template>
  5552. </xsl:with-param>
  5553. </xsl:call-template>
  5554. </xsl:if>
  5555. <!-- Other attributes -->
  5556. <xsl:call-template name="DisplayOtherAttributes">
  5557. <xsl:with-param name="component" select="."/>
  5558. <xsl:with-param name="attrsNotToDisplay">*source+</xsl:with-param>
  5559. </xsl:call-template>
  5560. </xsl:with-param>
  5561. <xsl:with-param name="hasAnyContent">true</xsl:with-param>
  5562. </xsl:call-template>
  5563. </xsl:template>
  5564. <!--
  5565. Prints out schema component representation of
  5566. key reference constraints.
  5567. Param(s):
  5568. margin (nonNegativeInteger) optional
  5569. Number of 'em' to indent from left
  5570. -->
  5571. <xsl:template match="xsd:keyref" mode="schemaComponent">
  5572. <xsl:param name="margin">0</xsl:param>
  5573. <xsl:call-template name="DisplaySchemaComponent">
  5574. <xsl:with-param name="component" select="."/>
  5575. <xsl:with-param name="margin" select="$margin"/>
  5576. <xsl:with-param name="attributes">
  5577. <!-- Attribute: name -->
  5578. <xsl:call-template name="DisplayAttr">
  5579. <xsl:with-param name="attrName">name</xsl:with-param>
  5580. <xsl:with-param name="attrValue" select="normalize-space(@name)"/>
  5581. </xsl:call-template>
  5582. <!-- Attribute: refers -->
  5583. <xsl:call-template name="DisplayAttr">
  5584. <xsl:with-param name="attrName">refer</xsl:with-param>
  5585. <xsl:with-param name="attrValue">
  5586. <xsl:call-template name="PrintKeyRef">
  5587. <xsl:with-param name="ref">
  5588. <xsl:value-of select="normalize-space(@refer)"/>
  5589. </xsl:with-param>
  5590. </xsl:call-template>
  5591. </xsl:with-param>
  5592. </xsl:call-template>
  5593. <!-- Other attributes -->
  5594. <xsl:call-template name="DisplayOtherAttributes">
  5595. <xsl:with-param name="component" select="."/>
  5596. <xsl:with-param name="attrsNotToDisplay">*name+*refer+</xsl:with-param>
  5597. </xsl:call-template>
  5598. </xsl:with-param>
  5599. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5600. </xsl:call-template>
  5601. </xsl:template>
  5602. <!--
  5603. Prints out schema component representation of
  5604. derivations by extension and restrictions.
  5605. Param(s):
  5606. margin (nonNegativeInteger) optional
  5607. Number of 'em' to indent from left
  5608. -->
  5609. <xsl:template match="xsd:extension | xsd:restriction" mode="schemaComponent">
  5610. <xsl:param name="margin">0</xsl:param>
  5611. <xsl:call-template name="DisplaySchemaComponent">
  5612. <xsl:with-param name="component" select="."/>
  5613. <xsl:with-param name="margin" select="$margin"/>
  5614. <xsl:with-param name="attributes">
  5615. <!-- Attribute: base -->
  5616. <xsl:if test="@base">
  5617. <xsl:call-template name="DisplayAttr">
  5618. <xsl:with-param name="attrName">base</xsl:with-param>
  5619. <xsl:with-param name="attrValue">
  5620. <xsl:call-template name="PrintTypeRef">
  5621. <xsl:with-param name="ref" select="normalize-space(@base)"/>
  5622. </xsl:call-template>
  5623. </xsl:with-param>
  5624. </xsl:call-template>
  5625. </xsl:if>
  5626. <!-- Other attributes -->
  5627. <xsl:call-template name="DisplayOtherAttributes">
  5628. <xsl:with-param name="component" select="."/>
  5629. <xsl:with-param name="attrsNotToDisplay">*base+</xsl:with-param>
  5630. </xsl:call-template>
  5631. </xsl:with-param>
  5632. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5633. </xsl:call-template>
  5634. </xsl:template>
  5635. <!--
  5636. Prints out schema component representation of
  5637. derivations by list.
  5638. Param(s):
  5639. margin (nonNegativeInteger) optional
  5640. Number of 'em' to indent from left
  5641. -->
  5642. <xsl:template match="xsd:list" mode="schemaComponent">
  5643. <xsl:param name="margin">0</xsl:param>
  5644. <xsl:call-template name="DisplaySchemaComponent">
  5645. <xsl:with-param name="component" select="."/>
  5646. <xsl:with-param name="margin" select="$margin"/>
  5647. <xsl:with-param name="attributes">
  5648. <!-- Attribute: itemType-->
  5649. <xsl:if test="@itemType">
  5650. <xsl:call-template name="DisplayAttr">
  5651. <xsl:with-param name="attrName">itemType</xsl:with-param>
  5652. <xsl:with-param name="attrValue">
  5653. <xsl:call-template name="PrintTypeRef">
  5654. <xsl:with-param name="ref" select="normalize-space(@itemType)"/>
  5655. </xsl:call-template>
  5656. </xsl:with-param>
  5657. </xsl:call-template>
  5658. </xsl:if>
  5659. <!-- Other attributes -->
  5660. <xsl:call-template name="DisplayOtherAttributes">
  5661. <xsl:with-param name="component" select="."/>
  5662. <xsl:with-param name="attrsNotToDisplay">*itemType+</xsl:with-param>
  5663. </xsl:call-template>
  5664. </xsl:with-param>
  5665. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5666. </xsl:call-template>
  5667. </xsl:template>
  5668. <!--
  5669. Prints out schema component representation of
  5670. derivations by union.
  5671. Param(s):
  5672. margin (nonNegativeInteger) optional
  5673. Number of 'em' to indent from left
  5674. -->
  5675. <xsl:template match="xsd:union" mode="schemaComponent">
  5676. <xsl:param name="margin">0</xsl:param>
  5677. <xsl:call-template name="DisplaySchemaComponent">
  5678. <xsl:with-param name="component" select="."/>
  5679. <xsl:with-param name="margin" select="$margin"/>
  5680. <xsl:with-param name="attributes">
  5681. <!-- Attribute: memberTypes-->
  5682. <xsl:if test="@memberTypes">
  5683. <xsl:call-template name="DisplayAttr">
  5684. <xsl:with-param name="attrName">memberTypes</xsl:with-param>
  5685. <xsl:with-param name="attrValue">
  5686. <xsl:call-template name="PrintWhitespaceList">
  5687. <xsl:with-param name="value" select="normalize-space(@memberTypes)"/>
  5688. <xsl:with-param name="compType">type</xsl:with-param>
  5689. </xsl:call-template>
  5690. </xsl:with-param>
  5691. </xsl:call-template>
  5692. </xsl:if>
  5693. <!-- Other attributes -->
  5694. <xsl:call-template name="DisplayOtherAttributes">
  5695. <xsl:with-param name="component" select="."/>
  5696. <xsl:with-param name="attrsNotToDisplay">*memberTypes+</xsl:with-param>
  5697. </xsl:call-template>
  5698. </xsl:with-param>
  5699. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5700. </xsl:call-template>
  5701. </xsl:template>
  5702. <!--
  5703. Prints out schema component representation of
  5704. the root schema element.
  5705. Param(s):
  5706. margin (nonNegativeInteger) optional
  5707. Number of 'em' to indent from left
  5708. -->
  5709. <xsl:template match="xsd:schema" mode="schemaComponent">
  5710. <xsl:param name="margin">0</xsl:param>
  5711. <xsl:call-template name="DisplaySchemaComponent">
  5712. <xsl:with-param name="component" select="."/>
  5713. <xsl:with-param name="margin" select="$margin"/>
  5714. <xsl:with-param name="attributes">
  5715. <!-- Attribute: source -->
  5716. <xsl:if test="@xml:lang">
  5717. <xsl:call-template name="DisplayAttr">
  5718. <xsl:with-param name="attrName">xml:lang</xsl:with-param>
  5719. <xsl:with-param name="attrValue" select="normalize-space(@xml:lang)"/>
  5720. </xsl:call-template>
  5721. </xsl:if>
  5722. <!-- Other attributes -->
  5723. <xsl:call-template name="DisplayOtherAttributes">
  5724. <xsl:with-param name="component" select="."/>
  5725. <xsl:with-param name="attrsNotToDisplay">*lang+</xsl:with-param>
  5726. </xsl:call-template>
  5727. </xsl:with-param>
  5728. <xsl:with-param name="includeFilter">*include+*import+*redefine+</xsl:with-param>
  5729. </xsl:call-template>
  5730. </xsl:template>
  5731. <!--
  5732. Default way to print out schema component representation.
  5733. Param(s):
  5734. margin (nonNegativeInteger) optional
  5735. Number of 'em' to indent from left
  5736. -->
  5737. <xsl:template match="*" mode="schemaComponent">
  5738. <xsl:param name="margin">0</xsl:param>
  5739. <xsl:call-template name="DisplaySchemaComponent">
  5740. <xsl:with-param name="component" select="."/>
  5741. <xsl:with-param name="margin" select="$margin"/>
  5742. <xsl:with-param name="attributes">
  5743. <xsl:call-template name="DisplayOtherAttributes">
  5744. <xsl:with-param name="component" select="."/>
  5745. </xsl:call-template>
  5746. </xsl:with-param>
  5747. <xsl:with-param name="excludeFilter">*annotation+</xsl:with-param>
  5748. </xsl:call-template>
  5749. </xsl:template>
  5750. <!--
  5751. Prints out comments in schema component representation.
  5752. Param(s):
  5753. margin (nonNegativeInteger) optional
  5754. Number of 'em' to indent from left
  5755. -->
  5756. <xsl:template match="comment()" mode="schemaComponent">
  5757. <xsl:param name="margin">0</xsl:param>
  5758. <div class="comment" style="margin-left: {$margin}em">
  5759. <xsl:text>&lt;--</xsl:text>
  5760. <xsl:value-of select="."/>
  5761. <xsl:text>--&gt;</xsl:text>
  5762. </div>
  5763. </xsl:template>
  5764. <!--
  5765. Displays a schema element in the correct format
  5766. for the Schema Component Representation table, e.g.
  5767. tags are one color, and content are another.
  5768. Param(s):
  5769. component (Node) required
  5770. Schema element to be displayed
  5771. attributes (Result Tree Fragment) optional
  5772. Pre-formatted attributes of schema element
  5773. margin (nonNegativeInteger) optional
  5774. Number of 'em' to indent from left
  5775. hasAnyContent (boolean) optional
  5776. Set to true if schema element can accept
  5777. child elements from namespaces other than
  5778. the schema namespace, e.g. 'documentation'
  5779. and 'appinfo'
  5780. includeFilter (String) optional
  5781. List of element names, sandwiched between the
  5782. characters, '*' and '+'. If specified, only the
  5783. child elements of the component with tags in
  5784. the list will be displayed.
  5785. excludeFilter (String) optional
  5786. List of element names, sandwiched between the
  5787. characters, '*' and '+'. If specified, display
  5788. all child elements of the component, except
  5789. those with tags in the list.
  5790. -->
  5791. <xsl:template name="DisplaySchemaComponent">
  5792. <xsl:param name="component"/>
  5793. <xsl:param name="attributes"/>
  5794. <xsl:param name="margin">0</xsl:param>
  5795. <xsl:param name="hasAnyContent">false</xsl:param>
  5796. <xsl:param name="includeFilter"/>
  5797. <xsl:param name="excludeFilter"/>
  5798. <xsl:variable name="tag">
  5799. <xsl:call-template name="PrintNSPrefix">
  5800. <xsl:with-param name="prefix">
  5801. <xsl:call-template name="GetXSDPrefix"/>
  5802. </xsl:with-param>
  5803. <xsl:with-param name="nolink">true</xsl:with-param>
  5804. </xsl:call-template>
  5805. <xsl:value-of select="local-name($component)"/>
  5806. </xsl:variable>
  5807. <div style="margin-left: {$margin}em">
  5808. <!-- Start Tag -->
  5809. <xsl:text>&lt;</xsl:text>
  5810. <span class="scTag">
  5811. <xsl:copy-of select="$tag"/>
  5812. </span>
  5813. <!-- Attributes -->
  5814. <xsl:copy-of select="$attributes"/>
  5815. <!-- Content -->
  5816. <xsl:variable name="content">
  5817. <xsl:choose>
  5818. <!-- Include filter is on -->
  5819. <xsl:when test="$includeFilter!=''">
  5820. <xsl:apply-templates select="$component/xsd:*[contains($includeFilter, concat('*', local-name(.), '+'))]" mode="schemaComponent">
  5821. <xsl:with-param name="margin" select="$ELEM_INDENT"/>
  5822. </xsl:apply-templates>
  5823. <div class="scContent" style="margin-left: {$ELEM_INDENT}em">...</div>
  5824. </xsl:when>
  5825. <!-- Exclude filter is on -->
  5826. <xsl:when test="$excludeFilter!=''">
  5827. <xsl:apply-templates select="comment() | $component/xsd:*[not(contains($excludeFilter, concat('*', local-name(.), '+')))]" mode="schemaComponent">
  5828. <xsl:with-param name="margin" select="$ELEM_INDENT"/>
  5829. </xsl:apply-templates>
  5830. </xsl:when>
  5831. <!-- Permits any content -->
  5832. <xsl:when test="$hasAnyContent='true'">
  5833. <div class="scContent" style="margin-left: {$ELEM_INDENT}em">
  5834. <xsl:apply-templates select="comment() | $component/* | $component/text()" mode="xpp"/>
  5835. </div>
  5836. </xsl:when>
  5837. <!-- Contains schema elements -->
  5838. <xsl:otherwise>
  5839. <xsl:apply-templates select="comment() | $component/xsd:*" mode="schemaComponent">
  5840. <xsl:with-param name="margin" select="$ELEM_INDENT"/>
  5841. </xsl:apply-templates>
  5842. </xsl:otherwise>
  5843. </xsl:choose>
  5844. </xsl:variable>
  5845. <xsl:choose>
  5846. <!-- Has content -->
  5847. <xsl:when test="normalize-space($content)!=''">
  5848. <!-- End of start tag -->
  5849. <xsl:text>></xsl:text>
  5850. <!-- Content -->
  5851. <xsl:copy-of select="$content"/>
  5852. <!-- End Tag -->
  5853. <xsl:text>&lt;/</xsl:text>
  5854. <span class="scTag">
  5855. <xsl:copy-of select="$tag"/>
  5856. </span>
  5857. <xsl:text>></xsl:text>
  5858. </xsl:when>
  5859. <!-- Empty content -->
  5860. <xsl:otherwise>
  5861. <!-- End of start tag -->
  5862. <xsl:text>/></xsl:text>
  5863. </xsl:otherwise>
  5864. </xsl:choose>
  5865. </div>
  5866. </xsl:template>
  5867. <!--
  5868. Displays a schema attribute in the correct format
  5869. for the Schema Component Representation table, e.g.
  5870. tags are one color, and content are another.
  5871. Param(s):
  5872. attrName (String) required
  5873. Name of attribute
  5874. attrValue (Result Tree Fragment) required
  5875. Value of attribute, which may be links
  5876. -->
  5877. <xsl:template name="DisplayAttr">
  5878. <xsl:param name="attrName"/>
  5879. <xsl:param name="attrValue"/>
  5880. <xsl:text> </xsl:text>
  5881. <span class="scTag">
  5882. <xsl:value-of select="$attrName"/>
  5883. </span>
  5884. <xsl:text>="</xsl:text>
  5885. <xsl:if test="normalize-space($attrValue)!=''">
  5886. <span class="scContent">
  5887. <xsl:copy-of select="$attrValue"/>
  5888. </span>
  5889. </xsl:if>
  5890. <xsl:text>"</xsl:text>
  5891. </xsl:template>
  5892. <!--
  5893. Displays attributes from a schema element, unless
  5894. otherwise specified, in the correct format
  5895. for the Schema Component Representation table, e.g.
  5896. tags are one color, and content are another.
  5897. Param(s):
  5898. component (Node) required
  5899. Schema element whose attributes are to be displayed
  5900. attrsNotToDisplay (String) required
  5901. List of attributes not to be displayed
  5902. Each attribute name should prepended with '*'
  5903. and appended with '+'
  5904. -->
  5905. <xsl:template name="DisplayOtherAttributes">
  5906. <xsl:param name="component"/>
  5907. <xsl:param name="attrsNotToDisplay"/>
  5908. <xsl:for-each select="$component/attribute::*">
  5909. <xsl:variable name="attrName" select="local-name(.)"/>
  5910. <xsl:if test="not(contains($attrsNotToDisplay, concat('*', $attrName, '+')))">
  5911. <xsl:call-template name="DisplayAttr">
  5912. <xsl:with-param name="attrName" select="normalize-space($attrName)"/>
  5913. <xsl:with-param name="attrValue" select="normalize-space(.)"/>
  5914. </xsl:call-template>
  5915. </xsl:if>
  5916. </xsl:for-each>
  5917. </xsl:template>
  5918. <!-- ******** XML Pretty Printer ******** -->
  5919. <!--
  5920. Puts XHTML elements into the result.
  5921. -->
  5922. <xsl:template match="html:*" mode="html">
  5923. <xsl:element name="{local-name(.)}">
  5924. <xsl:for-each select="@*">
  5925. <xsl:copy-of select="."/>
  5926. </xsl:for-each>
  5927. <xsl:apply-templates select="* | text()" mode="html"/>
  5928. </xsl:element>
  5929. </xsl:template>
  5930. <!--
  5931. Displays non-XHTML elements found within XHTML elements.
  5932. -->
  5933. <xsl:template match="*" mode="html">
  5934. <xsl:call-template name="WriteElement">
  5935. <xsl:with-param name="element" select="."/>
  5936. <xsl:with-param name="mode">html</xsl:with-param>
  5937. </xsl:call-template>
  5938. </xsl:template>
  5939. <!--
  5940. Displays text node.
  5941. -->
  5942. <xsl:template match="text()" mode="html">
  5943. <xsl:value-of select="."/>
  5944. </xsl:template>
  5945. <!--
  5946. Displays an arbitrary XML element.
  5947. -->
  5948. <xsl:template match="*" mode="xpp">
  5949. <code>
  5950. <xsl:call-template name="WriteElement">
  5951. <xsl:with-param name="element" select="."/>
  5952. <xsl:with-param name="mode">xpp</xsl:with-param>
  5953. </xsl:call-template>
  5954. </code>
  5955. </xsl:template>
  5956. <!--
  5957. Displays an arbitrary XML text node.
  5958. -->
  5959. <xsl:template match="text()" mode="xpp">
  5960. <xsl:value-of select="."/>
  5961. </xsl:template>
  5962. <!--
  5963. Displays an XML comment.
  5964. -->
  5965. <xsl:template match="comment()" mode="xpp">
  5966. <div class="comment">
  5967. <xsl:text>&lt;--</xsl:text>
  5968. <xsl:value-of select="."/>
  5969. <xsl:text>--&gt;</xsl:text>
  5970. </div>
  5971. </xsl:template>
  5972. <!--
  5973. Displays an XML element in the documentation, e.g.
  5974. tags are escaped.
  5975. Param(s):
  5976. element (Node) required
  5977. XML element to display
  5978. mode (xpp|html) required
  5979. Which mode to invoke for child elements
  5980. -->
  5981. <xsl:template name="WriteElement">
  5982. <xsl:param name="element"/>
  5983. <xsl:param name="mode">xpp</xsl:param>
  5984. <!-- Start Tag -->
  5985. <xsl:text>&lt;</xsl:text>
  5986. <xsl:call-template name="PrintNSPrefix">
  5987. <xsl:with-param name="prefix">
  5988. <xsl:call-template name="GetRefPrefix">
  5989. <xsl:with-param name="ref" select="name($element)"/>
  5990. </xsl:call-template>
  5991. </xsl:with-param>
  5992. </xsl:call-template>
  5993. <xsl:value-of select="local-name($element)"/>
  5994. <!-- Attributes -->
  5995. <xsl:for-each select="$element/@*">
  5996. <xsl:text> </xsl:text>
  5997. <xsl:value-of select="name(.)"/>
  5998. <xsl:text>="</xsl:text>
  5999. <xsl:value-of select="."/>
  6000. <xsl:text>"</xsl:text>
  6001. </xsl:for-each>
  6002. <xsl:choose>
  6003. <xsl:when test="$element/* | $element/text()">
  6004. <!-- Close Start Tag -->
  6005. <xsl:text>> </xsl:text>
  6006. <!-- Content -->
  6007. <xsl:choose>
  6008. <xsl:when test="$mode!='xpp'">
  6009. <xsl:apply-templates select="$element/* | $element/text()" mode="html"/>
  6010. </xsl:when>
  6011. <xsl:otherwise>
  6012. <div style="margin-left: {$ELEM_INDENT}em">
  6013. <xsl:apply-templates select="$element/* | $element/text()" mode="xpp"/>
  6014. </div>
  6015. </xsl:otherwise>
  6016. </xsl:choose>
  6017. <!-- End Tag -->
  6018. <xsl:text>&lt;/</xsl:text>
  6019. <xsl:call-template name="PrintNSPrefix">
  6020. <xsl:with-param name="prefix">
  6021. <xsl:call-template name="GetRefPrefix">
  6022. <xsl:with-param name="ref" select="name($element)"/>
  6023. </xsl:call-template>
  6024. </xsl:with-param>
  6025. </xsl:call-template>
  6026. <xsl:value-of select="local-name($element)"/>
  6027. <xsl:text>></xsl:text>
  6028. </xsl:when>
  6029. <xsl:otherwise>
  6030. <!-- Close Start Tag -->
  6031. <xsl:text>/></xsl:text>
  6032. </xsl:otherwise>
  6033. </xsl:choose>
  6034. </xsl:template>
  6035. <!-- ******** Templates for Handling References ******** -->
  6036. <!--
  6037. Prints out a reference to a term in the glossary section.
  6038. Param(s):
  6039. code (String) required
  6040. Unique ID of glossary term
  6041. term (String) optional
  6042. Glossary term
  6043. -->
  6044. <xsl:template name="PrintGlossaryTermRef">
  6045. <xsl:param name="code"/>
  6046. <xsl:param name="term"/>
  6047. <xsl:choose>
  6048. <xsl:when test="$code !='' and normalize-space(translate($printGlossary,'TRUE','true'))='true'">
  6049. <a title="Look up '{$term}' in glossary" href="#{concat($TERM_PREFIX, $code)}">
  6050. <xsl:choose>
  6051. <xsl:when test="$term!=''">
  6052. <xsl:value-of select="$term"/>
  6053. </xsl:when>
  6054. <xsl:otherwise>
  6055. <xsl:text>[term]</xsl:text>
  6056. </xsl:otherwise>
  6057. </xsl:choose>
  6058. </a>
  6059. </xsl:when>
  6060. <xsl:otherwise>
  6061. <xsl:value-of select="$term"/>
  6062. </xsl:otherwise>
  6063. </xsl:choose>
  6064. </xsl:template>
  6065. <!--
  6066. Prints out a reference to a namespace in the schema.
  6067. Param(s):
  6068. prefix (String) required
  6069. Namespace prefix referenced
  6070. schemaLoc (String) optional
  6071. Schema file containing this namespace prefix;
  6072. if in current schema, 'schemaLoc' is set to 'this'
  6073. -->
  6074. <xsl:template name="PrintNamespaceRef">
  6075. <xsl:param name="prefix"/>
  6076. <xsl:param name="schemaLoc">this</xsl:param>
  6077. <xsl:if test="$prefix!=''">
  6078. <xsl:choose>
  6079. <xsl:when test="/xsd:schema/namespace::*[local-name(.)=normalize-space($prefix)]">
  6080. <xsl:variable name="link">
  6081. <xsl:if test="normalize-space($schemaLoc)!='this'">
  6082. <xsl:call-template name="GetSchemaDocLocation">
  6083. <xsl:with-param name="uri" select="$schemaLoc"/>
  6084. </xsl:call-template>
  6085. </xsl:if>
  6086. <xsl:value-of select="concat('#', $NS_PREFIX, $prefix)"/>
  6087. </xsl:variable>
  6088. <a href="{$link}" title="Find out namespace of '{$prefix}' prefix">
  6089. <xsl:value-of select="$prefix"/>
  6090. </a>
  6091. </xsl:when>
  6092. <xsl:otherwise>
  6093. <xsl:variable name="title">
  6094. <xsl:text>Unknown namespace prefix, </xsl:text>
  6095. <xsl:value-of select="$prefix"/>
  6096. <xsl:text>.</xsl:text>
  6097. </xsl:variable>
  6098. <a href="javascript:void(0)" onclick="alert('{$title}')" title="{$title}">
  6099. <xsl:value-of select="$prefix"/>
  6100. </a>
  6101. </xsl:otherwise>
  6102. </xsl:choose>
  6103. </xsl:if>
  6104. </xsl:template>
  6105. <!--
  6106. Generates a link to an attribute.
  6107. Param(s):
  6108. name (String) optional
  6109. Name of attribute
  6110. ref (String) optional
  6111. Reference to attribute
  6112. (One of 'name' and 'ref' must be provided.)
  6113. schemaLoc (String) optional
  6114. Schema file containing this attribute reference
  6115. if in current schema, 'schemaLoc' is set to 'this'
  6116. -->
  6117. <xsl:template name="PrintAttributeRef">
  6118. <xsl:param name="name"/>
  6119. <xsl:param name="ref"/>
  6120. <xsl:param name="schemaLoc">this</xsl:param>
  6121. <xsl:choose>
  6122. <xsl:when test="$name!=''">
  6123. <xsl:call-template name="PrintCompName">
  6124. <xsl:with-param name="name" select="$name"/>
  6125. <xsl:with-param name="compType">attribute</xsl:with-param>
  6126. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6127. </xsl:call-template>
  6128. </xsl:when>
  6129. <xsl:when test="$ref!=''">
  6130. <xsl:call-template name="PrintCompRef">
  6131. <xsl:with-param name="ref" select="$ref"/>
  6132. <xsl:with-param name="compType">attribute</xsl:with-param>
  6133. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6134. </xsl:call-template>
  6135. </xsl:when>
  6136. </xsl:choose>
  6137. </xsl:template>
  6138. <!--
  6139. Generates a link to an attribute group.
  6140. Param(s):
  6141. name (String) optional
  6142. Name of attribute group
  6143. ref (String) optional
  6144. Reference to attribute group
  6145. (One of 'name' and 'ref' must be provided.)
  6146. schemaLoc (String) optional
  6147. Schema file containing this attribute group reference
  6148. if in current schema, 'schemaLoc' is set to 'this'
  6149. -->
  6150. <xsl:template name="PrintAttributeGroupRef">
  6151. <xsl:param name="name"/>
  6152. <xsl:param name="ref"/>
  6153. <xsl:param name="schemaLoc">this</xsl:param>
  6154. <xsl:choose>
  6155. <xsl:when test="$name!=''">
  6156. <xsl:call-template name="PrintCompName">
  6157. <xsl:with-param name="name" select="$name"/>
  6158. <xsl:with-param name="compType">attribute group</xsl:with-param>
  6159. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6160. </xsl:call-template>
  6161. </xsl:when>
  6162. <xsl:when test="$ref!=''">
  6163. <xsl:call-template name="PrintCompRef">
  6164. <xsl:with-param name="ref" select="$ref"/>
  6165. <xsl:with-param name="compType">attribute group</xsl:with-param>
  6166. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6167. </xsl:call-template>
  6168. </xsl:when>
  6169. </xsl:choose>
  6170. </xsl:template>
  6171. <!--
  6172. Generates a link to an element.
  6173. Param(s):
  6174. name (String) optional
  6175. Name of element
  6176. ref (String) optional
  6177. Reference to element
  6178. (One of 'name' and 'ref' must be provided.)
  6179. schemaLoc (String) optional
  6180. Schema file containing this element reference
  6181. if in current schema, 'schemaLoc' is set to 'this'
  6182. -->
  6183. <xsl:template name="PrintElementRef">
  6184. <xsl:param name="name"/>
  6185. <xsl:param name="ref"/>
  6186. <xsl:param name="schemaLoc">this</xsl:param>
  6187. <xsl:choose>
  6188. <xsl:when test="$name!=''">
  6189. <xsl:call-template name="PrintCompName">
  6190. <xsl:with-param name="name" select="$name"/>
  6191. <xsl:with-param name="compType">element</xsl:with-param>
  6192. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6193. </xsl:call-template>
  6194. </xsl:when>
  6195. <xsl:when test="$ref!=''">
  6196. <xsl:call-template name="PrintCompRef">
  6197. <xsl:with-param name="ref" select="$ref"/>
  6198. <xsl:with-param name="compType">element</xsl:with-param>
  6199. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6200. </xsl:call-template>
  6201. </xsl:when>
  6202. </xsl:choose>
  6203. </xsl:template>
  6204. <!--
  6205. Generates a link to a group.
  6206. Param(s):
  6207. name (String) optional
  6208. Name of group
  6209. ref (String) optional
  6210. Reference to group
  6211. (One of 'name' and 'ref' must be provided.)
  6212. schemaLoc (String) optional
  6213. Schema file containing this group reference
  6214. if in current schema, 'schemaLoc' is set to 'this'
  6215. -->
  6216. <xsl:template name="PrintGroupRef">
  6217. <xsl:param name="name"/>
  6218. <xsl:param name="ref"/>
  6219. <xsl:param name="schemaLoc">this</xsl:param>
  6220. <xsl:choose>
  6221. <xsl:when test="$name!=''">
  6222. <xsl:call-template name="PrintCompName">
  6223. <xsl:with-param name="name" select="$name"/>
  6224. <xsl:with-param name="compType">group</xsl:with-param>
  6225. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6226. </xsl:call-template>
  6227. </xsl:when>
  6228. <xsl:when test="$ref!=''">
  6229. <xsl:call-template name="PrintCompRef">
  6230. <xsl:with-param name="ref" select="$ref"/>
  6231. <xsl:with-param name="compType">group</xsl:with-param>
  6232. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6233. </xsl:call-template>
  6234. </xsl:when>
  6235. </xsl:choose>
  6236. </xsl:template>
  6237. <!--
  6238. Generates a link to a key/uniqueness constraint.
  6239. Param(s):
  6240. name (String) optional
  6241. Name of key/uniqueness constraint
  6242. ref (String) optional
  6243. Reference to key/uniqueness constraint
  6244. (One of 'name' and 'ref' must be provided.)
  6245. schemaLoc (String) optional
  6246. Schema file containing this key/uniqueness constraint
  6247. reference; if in current schema, 'schemaLoc' is set
  6248. to 'this'
  6249. -->
  6250. <xsl:template name="PrintKeyRef">
  6251. <xsl:param name="name"/>
  6252. <xsl:param name="ref"/>
  6253. <xsl:param name="schemaLoc">this</xsl:param>
  6254. <xsl:choose>
  6255. <xsl:when test="$name!=''">
  6256. <xsl:call-template name="PrintCompName">
  6257. <xsl:with-param name="name" select="$name"/>
  6258. <xsl:with-param name="compType">uniqueness/key constraint</xsl:with-param>
  6259. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6260. </xsl:call-template>
  6261. </xsl:when>
  6262. <xsl:when test="$ref!=''">
  6263. <xsl:call-template name="PrintCompRef">
  6264. <xsl:with-param name="ref" select="$ref"/>
  6265. <xsl:with-param name="compType">uniqueness/key constraint</xsl:with-param>
  6266. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6267. </xsl:call-template>
  6268. </xsl:when>
  6269. </xsl:choose>
  6270. </xsl:template>
  6271. <!--
  6272. Generates a link to a type.
  6273. Param(s):
  6274. name (String) optional
  6275. Name of type
  6276. ref (String) optional
  6277. Reference to type
  6278. (One of 'name' and 'ref' must be provided.)
  6279. schemaLoc (String) optional
  6280. Schema file containing this type reference'
  6281. if in current schema, 'schemaLoc' is set
  6282. to 'this'
  6283. -->
  6284. <xsl:template name="PrintTypeRef">
  6285. <xsl:param name="name"/>
  6286. <xsl:param name="ref"/>
  6287. <xsl:param name="schemaLoc">this</xsl:param>
  6288. <xsl:choose>
  6289. <xsl:when test="$name!=''">
  6290. <span class="type">
  6291. <xsl:call-template name="PrintCompName">
  6292. <xsl:with-param name="name" select="$name"/>
  6293. <xsl:with-param name="compType">type</xsl:with-param>
  6294. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6295. </xsl:call-template>
  6296. </span>
  6297. </xsl:when>
  6298. <xsl:when test="$ref!=''">
  6299. <span class="type">
  6300. <xsl:call-template name="PrintCompRef">
  6301. <xsl:with-param name="ref" select="$ref"/>
  6302. <xsl:with-param name="compType">type</xsl:with-param>
  6303. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6304. </xsl:call-template>
  6305. </span>
  6306. </xsl:when>
  6307. </xsl:choose>
  6308. </xsl:template>
  6309. <!--
  6310. Prints out a link to a schema component's section.
  6311. Param(s):
  6312. baseFile (String) optional
  6313. Documentation file of schema containing this
  6314. component.
  6315. If this component belongs to the current schema,
  6316. omit this variable.
  6317. If this component is from an included or imported
  6318. schema, provide this variable.
  6319. name (String) required
  6320. Name of schema component
  6321. compType (String) required
  6322. Type of schema component
  6323. errMsg (String) optional
  6324. Sentence fragment.
  6325. If specified, link will open up an alert box with
  6326. an error message. For example, if 'errMsg' was set
  6327. to "could not be found", 'name' was "x", and
  6328. 'compType' was "type", the error message would be:
  6329. "x" type definition could not be found.
  6330. The sentence fragment should not:
  6331. -start with a capital letter.
  6332. -have a space in front
  6333. -end with a period.
  6334. schemaLoc (String) optional
  6335. Schema file containing this component;
  6336. if in current schema, 'schemaLoc' is set to 'this'
  6337. -->
  6338. <xsl:template name="PrintCompName">
  6339. <xsl:param name="baseFile"/>
  6340. <xsl:param name="name"/>
  6341. <xsl:param name="compType"/>
  6342. <xsl:param name="schemaLoc">this</xsl:param>
  6343. <xsl:param name="errMsg"/>
  6344. <!-- Get correct terminology for statements -->
  6345. <xsl:variable name="noun">
  6346. <xsl:choose>
  6347. <xsl:when test="$compType='element' or $compType='attribute'">
  6348. <xsl:text>declaration</xsl:text>
  6349. </xsl:when>
  6350. <xsl:otherwise>
  6351. <xsl:text>definition</xsl:text>
  6352. </xsl:otherwise>
  6353. </xsl:choose>
  6354. </xsl:variable>
  6355. <!-- Get prefix to use in anchor name. -->
  6356. <xsl:variable name="compPrefix">
  6357. <xsl:choose>
  6358. <xsl:when test="$compType='attribute'">
  6359. <xsl:value-of select="$ATTR_PREFIX"/>
  6360. </xsl:when>
  6361. <xsl:when test="$compType='attribute group'">
  6362. <xsl:value-of select="$ATTR_GRP_PREFIX"/>
  6363. </xsl:when>
  6364. <xsl:when test="$compType='element'">
  6365. <xsl:value-of select="$ELEM_PREFIX"/>
  6366. </xsl:when>
  6367. <xsl:when test="$compType='group'">
  6368. <xsl:value-of select="$GRP_PREFIX"/>
  6369. </xsl:when>
  6370. <xsl:when test="$compType='type'">
  6371. <xsl:value-of select="$TYPE_PREFIX"/>
  6372. </xsl:when>
  6373. <xsl:when test="$compType='uniqueness/key constraint'">
  6374. <xsl:value-of select="$KEY_PREFIX"/>
  6375. </xsl:when>
  6376. </xsl:choose>
  6377. </xsl:variable>
  6378. <!-- Get base URI. -->
  6379. <xsl:variable name="baseURI">
  6380. <xsl:choose>
  6381. <xsl:when test="$baseFile!=''">
  6382. <xsl:value-of select="$baseFile"/>
  6383. </xsl:when>
  6384. <xsl:when test="normalize-space($schemaLoc)!='this'">
  6385. <xsl:call-template name="GetSchemaDocLocation">
  6386. <xsl:with-param name="uri" select="$schemaLoc"/>
  6387. </xsl:call-template>
  6388. </xsl:when>
  6389. </xsl:choose>
  6390. </xsl:variable>
  6391. <!-- Generate message. -->
  6392. <xsl:variable name="title">
  6393. <xsl:choose>
  6394. <!-- Error message was provided. -->
  6395. <xsl:when test="$errMsg!=''">
  6396. <xsl:text>"</xsl:text><xsl:value-of select="$name"/><xsl:text>" </xsl:text>
  6397. <xsl:value-of select="$compType"/><xsl:text> </xsl:text>
  6398. <xsl:value-of select="$noun"/><xsl:text> </xsl:text>
  6399. <xsl:value-of select="$errMsg"/>
  6400. </xsl:when>
  6401. <!-- There exists a link to the schema component's
  6402. documentation. -->
  6403. <xsl:otherwise>
  6404. <xsl:text>Jump to "</xsl:text>
  6405. <xsl:value-of select="$name"/>
  6406. <xsl:text>" </xsl:text>
  6407. <xsl:value-of select="$compType"/>
  6408. <xsl:text> </xsl:text>
  6409. <xsl:value-of select="$noun"/>
  6410. <!-- External link -->
  6411. <xsl:if test="normalize-space($baseURI)!=''">
  6412. <xsl:text>(located in external schema documentation)</xsl:text>
  6413. </xsl:if>
  6414. </xsl:otherwise>
  6415. </xsl:choose>
  6416. <xsl:text>.</xsl:text>
  6417. </xsl:variable>
  6418. <!-- Generate href link -->
  6419. <xsl:variable name="link">
  6420. <xsl:choose>
  6421. <!-- Error message was provided. -->
  6422. <xsl:when test="$errMsg!=''">
  6423. <xsl:text>javascript:void(0)</xsl:text>
  6424. </xsl:when>
  6425. <!-- There exists a link to the schema component's
  6426. documentation. -->
  6427. <xsl:otherwise>
  6428. <!-- Base URI -->
  6429. <xsl:value-of select="normalize-space($baseURI)"/>
  6430. <!-- Anchor within URI -->
  6431. <xsl:value-of select="concat('#',normalize-space($compPrefix),normalize-space($name))"/>
  6432. </xsl:otherwise>
  6433. </xsl:choose>
  6434. </xsl:variable>
  6435. <a title="{$title}" href="{$link}">
  6436. <!-- External link -->
  6437. <xsl:if test="normalize-space($baseURI)!=''">
  6438. <xsl:attribute name="class">externalLink</xsl:attribute>
  6439. </xsl:if>
  6440. <!-- Error message was provided. -->
  6441. <xsl:if test="$errMsg!=''">
  6442. <xsl:attribute name="onclick">
  6443. <xsl:text>alert('</xsl:text>
  6444. <xsl:value-of select="$title"/>
  6445. <xsl:text>');</xsl:text>
  6446. </xsl:attribute>
  6447. </xsl:if>
  6448. <xsl:value-of select="$name"/>
  6449. </a>
  6450. </xsl:template>
  6451. <!--
  6452. Prints out a reference to a schema component.
  6453. This template will try to work out which schema that this
  6454. component belongs to and print out the appropriate link.
  6455. component.
  6456. It will also print out the namespace prefix given
  6457. in the reference.
  6458. Param(s):
  6459. ref (String) required
  6460. Reference to schema component
  6461. compType (String) required
  6462. Type of schema component
  6463. schemaLoc (String) optional
  6464. Schema file containing this component reference;
  6465. if in current schema, 'schemaLoc' is set to 'this'
  6466. -->
  6467. <xsl:template name="PrintCompRef">
  6468. <xsl:param name="ref"/>
  6469. <xsl:param name="compType"/>
  6470. <xsl:param name="schemaLoc">this</xsl:param>
  6471. <!-- Get correct terminology for statements -->
  6472. <xsl:variable name="noun">
  6473. <xsl:choose>
  6474. <xsl:when test="$compType='element' or $compType='attribute'">
  6475. <xsl:text>declaration</xsl:text>
  6476. </xsl:when>
  6477. <xsl:otherwise>
  6478. <xsl:text>definition</xsl:text>
  6479. </xsl:otherwise>
  6480. </xsl:choose>
  6481. </xsl:variable>
  6482. <!-- Get local name -->
  6483. <xsl:variable name="refName">
  6484. <xsl:call-template name="GetRefName">
  6485. <xsl:with-param name="ref" select="$ref"/>
  6486. </xsl:call-template>
  6487. </xsl:variable>
  6488. <!-- Get prefix -->
  6489. <xsl:variable name="refPrefix">
  6490. <xsl:call-template name="GetRefPrefix">
  6491. <xsl:with-param name="ref" select="$ref"/>
  6492. </xsl:call-template>
  6493. </xsl:variable>
  6494. <!-- Get prefix of this schema's target namespace -->
  6495. <xsl:variable name="tnPrefix">
  6496. <xsl:call-template name="GetThisPrefix"/>
  6497. </xsl:variable>
  6498. <!-- Get file location of the schema component that is
  6499. being referenced. -->
  6500. <xsl:variable name="compLoc">
  6501. <xsl:call-template name="FindComponent">
  6502. <xsl:with-param name="ref" select="$ref"/>
  6503. <xsl:with-param name="compType" select="$compType"/>
  6504. </xsl:call-template>
  6505. </xsl:variable>
  6506. <!-- Print prefix -->
  6507. <xsl:call-template name="PrintNSPrefix">
  6508. <xsl:with-param name="prefix" select="$refPrefix"/>
  6509. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6510. </xsl:call-template>
  6511. <!-- Print local name -->
  6512. <xsl:choose>
  6513. <!-- Component from XML Schema's or XML's namespace -->
  6514. <xsl:when test="normalize-space($compLoc)='xsd' or normalize-space($compLoc)='xml'">
  6515. <xsl:value-of select="$refName"/>
  6516. </xsl:when>
  6517. <!-- Component found in this schema. -->
  6518. <xsl:when test="normalize-space($compLoc)='this'">
  6519. <xsl:call-template name="PrintCompName">
  6520. <xsl:with-param name="name" select="$refName"/>
  6521. <xsl:with-param name="compType" select="$compType"/>
  6522. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6523. </xsl:call-template>
  6524. </xsl:when>
  6525. <!-- Component not found. -->
  6526. <xsl:when test="normalize-space($compLoc)='' or normalize-space($compLoc)='none'">
  6527. <xsl:call-template name="PrintCompName">
  6528. <xsl:with-param name="name" select="$refName"/>
  6529. <xsl:with-param name="compType" select="$compType"/>
  6530. <xsl:with-param name="errMsg">could not be found</xsl:with-param>
  6531. </xsl:call-template>
  6532. </xsl:when>
  6533. <!-- Component found in an external schema. -->
  6534. <xsl:otherwise>
  6535. <!-- Get documentation file for included schema. -->
  6536. <xsl:variable name="docFile">
  6537. <xsl:call-template name="GetSchemaDocLocation">
  6538. <xsl:with-param name="uri" select="$compLoc"/>
  6539. </xsl:call-template>
  6540. </xsl:variable>
  6541. <xsl:call-template name="PrintCompName">
  6542. <xsl:with-param name="baseFile" select="$docFile"/>
  6543. <xsl:with-param name="name" select="$refName"/>
  6544. <xsl:with-param name="compType" select="$compType"/>
  6545. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  6546. </xsl:call-template>
  6547. </xsl:otherwise>
  6548. </xsl:choose>
  6549. </xsl:template>
  6550. <!-- ******** Templates for Finding Components in Different
  6551. Schema documents ******** -->
  6552. <!-- Special key words: xml, xsd, this, none -->
  6553. <xsl:template name="FindComponent">
  6554. <xsl:param name="ref"/>
  6555. <xsl:param name="compType"/>
  6556. <!-- Get local name -->
  6557. <xsl:variable name="refName">
  6558. <xsl:call-template name="GetRefName">
  6559. <xsl:with-param name="ref" select="$ref"/>
  6560. </xsl:call-template>
  6561. </xsl:variable>
  6562. <!-- Get prefix -->
  6563. <xsl:variable name="refPrefix">
  6564. <xsl:call-template name="GetRefPrefix">
  6565. <xsl:with-param name="ref" select="$ref"/>
  6566. </xsl:call-template>
  6567. </xsl:variable>
  6568. <!-- Get prefix of this schema's target namespace -->
  6569. <xsl:variable name="tnPrefix">
  6570. <xsl:call-template name="GetThisPrefix"/>
  6571. </xsl:variable>
  6572. <!-- Get prefix of XML Schema -->
  6573. <xsl:variable name="xsdPrefix">
  6574. <xsl:call-template name="GetXSDPrefix"/>
  6575. </xsl:variable>
  6576. <xsl:choose>
  6577. <!-- Schema component from XML Schema's namespace,
  6578. unless this schema is for XML Schema -->
  6579. <xsl:when test="$refPrefix=$xsdPrefix and $xsdPrefix!=$tnPrefix">
  6580. <xsl:text>xsd</xsl:text>
  6581. </xsl:when>
  6582. <!-- Schema component from XML's namespace -->
  6583. <xsl:when test="$refPrefix='xml'">
  6584. <xsl:text>xml</xsl:text>
  6585. </xsl:when>
  6586. <!-- Schema component from current schema's namespace -->
  6587. <xsl:when test="$refPrefix=$tnPrefix">
  6588. <xsl:call-template name="FindComponentInSchema">
  6589. <xsl:with-param name="name" select="$refName"/>
  6590. <xsl:with-param name="compType" select="$compType"/>
  6591. <xsl:with-param name="schema" select="/xsd:schema"/>
  6592. <xsl:with-param name="schemaFileLoc">this</xsl:with-param>
  6593. </xsl:call-template>
  6594. </xsl:when>
  6595. <!-- Schema component from imported namespace -->
  6596. <xsl:when test="normalize-space(translate($searchImportedSchemas, 'TRUE', 'true'))='true'">
  6597. <xsl:variable name="refNS" select="/xsd:schema/namespace::*[local-name(.)=normalize-space($refPrefix)]"/>
  6598. <xsl:call-template name="FindComponentInImportedSchemas">
  6599. <xsl:with-param name="name" select="$refName"/>
  6600. <xsl:with-param name="compType" select="$compType"/>
  6601. <xsl:with-param name="compNS" select="$refNS"/>
  6602. <xsl:with-param name="schema" select="/xsd:schema"/>
  6603. <xsl:with-param name="index">1</xsl:with-param>
  6604. </xsl:call-template>
  6605. </xsl:when>
  6606. </xsl:choose>
  6607. </xsl:template>
  6608. <xsl:template name="FindComponentInSchema">
  6609. <xsl:param name="name"/>
  6610. <xsl:param name="compType"/>
  6611. <xsl:param name="schema"/>
  6612. <xsl:param name="schemaFileLoc"/>
  6613. <xsl:param name="schemasSearched"/>
  6614. <!-- Don't examine this schema if we've already
  6615. searched it. Prevents infinite recursion.
  6616. Also check if schema actually exists. -->
  6617. <xsl:if test="$schema and not(contains($schemasSearched, concat('*', $schemaFileLoc, '+')))">
  6618. <!-- Find out if the component is in this schema -->
  6619. <xsl:variable name="thisResult">
  6620. <xsl:call-template name="IsComponentInSchema">
  6621. <xsl:with-param name="name" select="$name"/>
  6622. <xsl:with-param name="compType" select="$compType"/>
  6623. <xsl:with-param name="schema" select="$schema"/>
  6624. </xsl:call-template>
  6625. </xsl:variable>
  6626. <xsl:choose>
  6627. <!-- Component found -->
  6628. <xsl:when test="normalize-space($thisResult)='true'">
  6629. <xsl:value-of select="$schemaFileLoc"/>
  6630. </xsl:when>
  6631. <!-- Component not found -->
  6632. <xsl:when test="normalize-space(translate($searchIncludedSchemas, 'TRUE', 'true'))='true'">
  6633. <!-- Search included schemas -->
  6634. <xsl:variable name="includeResult">
  6635. <xsl:call-template name="FindComponentInIncludedSchemas">
  6636. <xsl:with-param name="schema" select="$schema"/>
  6637. <xsl:with-param name="name" select="$name"/>
  6638. <xsl:with-param name="compType" select="$compType"/>
  6639. <xsl:with-param name="index">1</xsl:with-param>
  6640. <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaFileLoc, '+')"/>
  6641. </xsl:call-template>
  6642. </xsl:variable>
  6643. <xsl:choose>
  6644. <xsl:when test="normalize-space($includeResult)!='' and normalize-space($includeResult)!='none'">
  6645. <xsl:value-of select="$includeResult"/>
  6646. </xsl:when>
  6647. <xsl:otherwise>
  6648. <!-- Search redefined schemas -->
  6649. <xsl:call-template name="FindComponentInRedefinedSchemas">
  6650. <xsl:with-param name="schema" select="$schema"/>
  6651. <xsl:with-param name="name" select="$name"/>
  6652. <xsl:with-param name="compType" select="$compType"/>
  6653. <xsl:with-param name="index">1</xsl:with-param>
  6654. <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaFileLoc, '+')"/>
  6655. </xsl:call-template>
  6656. </xsl:otherwise>
  6657. </xsl:choose>
  6658. </xsl:when>
  6659. </xsl:choose>
  6660. </xsl:if>
  6661. </xsl:template>
  6662. <xsl:template name="IsComponentInSchema">
  6663. <xsl:param name="name"/>
  6664. <xsl:param name="compType"/>
  6665. <xsl:param name="schema"/>
  6666. <xsl:choose>
  6667. <!-- Schema not found. -->
  6668. <xsl:when test="not($schema)">
  6669. <xsl:text>false</xsl:text>
  6670. </xsl:when>
  6671. <!-- Search for attribute declaration. -->
  6672. <xsl:when test="$compType='attribute' and $schema/xsd:attribute[@name=$name]">
  6673. <xsl:text>true</xsl:text>
  6674. </xsl:when>
  6675. <!-- Search for attribute group definition. -->
  6676. <xsl:when test="$compType='attribute group' and ($schema/xsd:attributeGroup[@name=$name] or $schema/xsd:redefine/xsd:attributeGroup[@name=$name])">
  6677. <xsl:text>true</xsl:text>
  6678. </xsl:when>
  6679. <!-- Search for element declaration. -->
  6680. <xsl:when test="$compType='element' and $schema/xsd:element[@name=$name]">
  6681. <xsl:text>true</xsl:text>
  6682. </xsl:when>
  6683. <!-- Search for group definition. -->
  6684. <xsl:when test="$compType='group' and ($schema/xsd:group[@name=$name] or $schema/xsd:redefine/xsd:group[@name=$name])">
  6685. <xsl:text>true</xsl:text>
  6686. </xsl:when>
  6687. <!-- Search for complex type definition. -->
  6688. <xsl:when test="($compType='type' or $compType='complex type') and ($schema/xsd:complexType[@name=$name] or $schema/xsd:redefine/xsd:complexType[@name=$name])">
  6689. <xsl:text>true</xsl:text>
  6690. </xsl:when>
  6691. <!-- Search for simple type definition. -->
  6692. <xsl:when test="($compType='type' or $compType='simple type') and ($schema/xsd:simpleType[@name=$name] or $schema/xsd:redefine/xsd:simpleType[@name=$name])">
  6693. <xsl:text>true</xsl:text>
  6694. </xsl:when>
  6695. <!-- Search for uniqueness/key constraint definition. -->
  6696. <xsl:when test="$compType='uniqueness/key constraint' and ($schema//xsd:element/xsd:key[@name=$name] or $schema//xsd:element/xsd:unique[@name=$name])">
  6697. <xsl:text>true</xsl:text>
  6698. </xsl:when>
  6699. <!-- Component not found. -->
  6700. <xsl:otherwise>
  6701. <xsl:text>false</xsl:text>
  6702. </xsl:otherwise>
  6703. </xsl:choose>
  6704. </xsl:template>
  6705. <xsl:template name="FindComponentInIncludedSchemas">
  6706. <xsl:param name="schema"/>
  6707. <xsl:param name="name"/>
  6708. <xsl:param name="compType"/>
  6709. <xsl:param name="schemasSearched"/>
  6710. <xsl:param name="index">1</xsl:param>
  6711. <xsl:if test="count($schema/xsd:include) &gt;= number($index)">
  6712. <!-- Get the 'schemaLocation' attribute of the 'include'
  6713. element in this schema at position, 'index'. -->
  6714. <xsl:variable name="schemaLoc" select="$schema/xsd:include[position()=$index]/@schemaLocation"/>
  6715. <xsl:variable name="thisResult">
  6716. <!-- Search for the component in the current
  6717. included schema. -->
  6718. <xsl:call-template name="FindComponentInSchema">
  6719. <xsl:with-param name="name" select="$name"/>
  6720. <xsl:with-param name="compType" select="$compType"/>
  6721. <xsl:with-param name="schema" select="document($schemaLoc)/xsd:schema"/>
  6722. <xsl:with-param name="schemaFileLoc" select="$schemaLoc"/>
  6723. <xsl:with-param name="schemasSearched" select="$schemasSearched"/>
  6724. </xsl:call-template>
  6725. </xsl:variable>
  6726. <xsl:choose>
  6727. <!-- Component was found, so return result. -->
  6728. <xsl:when test="normalize-space($thisResult)!='' and normalize-space($thisResult)!='none'">
  6729. <xsl:value-of select="$thisResult"/>
  6730. </xsl:when>
  6731. <!-- Component was not found, so keep on searching. -->
  6732. <xsl:otherwise>
  6733. <!-- Examine other included schemas in this schema -->
  6734. <xsl:call-template name="FindComponentInIncludedSchemas">
  6735. <xsl:with-param name="schema" select="$schema"/>
  6736. <xsl:with-param name="name" select="$name"/>
  6737. <xsl:with-param name="compType" select="$compType"/>
  6738. <xsl:with-param name="index" select="number($index)+1"/>
  6739. <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaLoc, '+')"/>
  6740. </xsl:call-template>
  6741. </xsl:otherwise>
  6742. </xsl:choose>
  6743. </xsl:if>
  6744. </xsl:template>
  6745. <xsl:template name="FindComponentInRedefinedSchemas">
  6746. <xsl:param name="schema"/>
  6747. <xsl:param name="name"/>
  6748. <xsl:param name="compType"/>
  6749. <xsl:param name="schemasSearched"/>
  6750. <xsl:param name="index">1</xsl:param>
  6751. <xsl:if test="count($schema/xsd:redefine) &gt;= number($index)">
  6752. <!-- Get the 'schemaLocation' attribute of the 'redefine'
  6753. element in this schema at position, 'index'. -->
  6754. <xsl:variable name="schemaLoc" select="$schema/xsd:redefine[position()=$index]/@schemaLocation"/>
  6755. <xsl:variable name="thisResult">
  6756. <!-- Search for the component in the current
  6757. redefined schema. -->
  6758. <xsl:call-template name="FindComponentInSchema">
  6759. <xsl:with-param name="name" select="$name"/>
  6760. <xsl:with-param name="compType" select="$compType"/>
  6761. <xsl:with-param name="schema" select="document($schemaLoc)/xsd:schema"/>
  6762. <xsl:with-param name="schemaFileLoc" select="$schemaLoc"/>
  6763. <xsl:with-param name="schemasSearched" select="$schemasSearched"/>
  6764. </xsl:call-template>
  6765. </xsl:variable>
  6766. <xsl:choose>
  6767. <!-- Component was found, so return result. -->
  6768. <xsl:when test="normalize-space($thisResult)!='' and normalize-space($thisResult)!='none'">
  6769. <xsl:value-of select="$thisResult"/>
  6770. </xsl:when>
  6771. <!-- Component was not found, so keep on searching. -->
  6772. <xsl:otherwise>
  6773. <!-- Examine other redefined schemas in this schema -->
  6774. <xsl:call-template name="FindComponentInRedefinedSchemas">
  6775. <xsl:with-param name="schema" select="$schema"/>
  6776. <xsl:with-param name="name" select="$name"/>
  6777. <xsl:with-param name="compType" select="$compType"/>
  6778. <xsl:with-param name="index" select="number($index)+1"/>
  6779. <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaLoc, '+')"/>
  6780. </xsl:call-template>
  6781. </xsl:otherwise>
  6782. </xsl:choose>
  6783. </xsl:if>
  6784. </xsl:template>
  6785. <xsl:template name="FindComponentInImportedSchemas">
  6786. <xsl:param name="schema"/>
  6787. <xsl:param name="name"/>
  6788. <xsl:param name="compType"/>
  6789. <xsl:param name="compNS"/>
  6790. <xsl:param name="schemasSearched"/>
  6791. <xsl:param name="index">1</xsl:param>
  6792. <xsl:if test="count($schema/xsd:import) &gt;= number($index)">
  6793. <!-- Get the 'namespace' attribute of the 'import'
  6794. element in this schema at position, 'index'. -->
  6795. <xsl:variable name="schemaNS" select="$schema/xsd:import[position()=$index]/@namespace"/>
  6796. <!-- Get the 'schemaLocation' attribute. -->
  6797. <xsl:variable name="schemaLoc" select="$schema/xsd:import[position()=$index]/@schemaLocation"/>
  6798. <xsl:variable name="thisResult">
  6799. <!-- Check that the imported schema has the matching
  6800. namespace as the component that we're looking
  6801. for. -->
  6802. <xsl:if test="normalize-space($compNS)=normalize-space($schemaNS)">
  6803. <!-- Search for the component in the current
  6804. imported schema. -->
  6805. <xsl:call-template name="FindComponentInSchema">
  6806. <xsl:with-param name="name" select="$name"/>
  6807. <xsl:with-param name="compType" select="$compType"/>
  6808. <xsl:with-param name="schema" select="document($schemaLoc)/xsd:schema"/>
  6809. <xsl:with-param name="schemaFileLoc" select="$schemaLoc"/>
  6810. <xsl:with-param name="schemasSearched" select="$schemasSearched"/>
  6811. </xsl:call-template>
  6812. </xsl:if>
  6813. </xsl:variable>
  6814. <xsl:choose>
  6815. <!-- Component was found, so return result. -->
  6816. <xsl:when test="normalize-space($thisResult)!='' and normalize-space($thisResult)!='none'">
  6817. <xsl:value-of select="$thisResult"/>
  6818. </xsl:when>
  6819. <!-- Component was not found, so keep on searching. -->
  6820. <xsl:otherwise>
  6821. <!-- Examine other included schemas in this schema -->
  6822. <xsl:call-template name="FindComponentInImportedSchemas">
  6823. <xsl:with-param name="schema" select="$schema"/>
  6824. <xsl:with-param name="name" select="$name"/>
  6825. <xsl:with-param name="compType" select="$compType"/>
  6826. <xsl:with-param name="compNS" select="$compNS"/>
  6827. <xsl:with-param name="index" select="number($index)+1"/>
  6828. <xsl:with-param name="schemasSearched" select="concat($schemasSearched, '*', $schemaLoc, '+')"/>
  6829. </xsl:call-template>
  6830. </xsl:otherwise>
  6831. </xsl:choose>
  6832. </xsl:if>
  6833. </xsl:template>
  6834. <!-- ******** General Utility Templates ******** -->
  6835. <!--
  6836. Creates a box that can be opened and closed, such
  6837. that the contents can be hidden away until a button
  6838. is pressed.
  6839. Param(s):
  6840. id (String) required
  6841. Unique ID of the 'div' box
  6842. caption (String) required
  6843. Text describing the contents of the box;
  6844. it will always be shown even when the box
  6845. is closed
  6846. contents (String) required
  6847. Contents of box, which may appear and disappear
  6848. with the press of a button.
  6849. anchor (String) optional
  6850. Anchor, e.g. <a name="...", for this box
  6851. styleClass (String) optional
  6852. Additional CSS class for the entire collapseable box
  6853. isOpened (String) optional
  6854. Set to true if initially opened, and
  6855. false if initially closed
  6856. -->
  6857. <xsl:template name="CollapseableBox">
  6858. <xsl:param name="id"/>
  6859. <xsl:param name="caption"/>
  6860. <xsl:param name="contents"/>
  6861. <xsl:param name="anchor"/>
  6862. <xsl:param name="styleClass"/>
  6863. <xsl:param name="isOpened">false</xsl:param>
  6864. <xsl:variable name="buttonID" select="concat($id, '_button')"/>
  6865. <div class="{$styleClass} box">
  6866. <div>
  6867. <!-- Button to control the opening and closing of the 'div' box -->
  6868. <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
  6869. <input type="button" id="{$buttonID}" class="control" onclick="switchState('{$id}'); return false;" style="display: none"/>
  6870. <!--
  6871. Button's 'display' property is set to 'none',
  6872. so that button will only be displayed if
  6873. box can be successfully opened and closed.
  6874. -->
  6875. </xsl:if>
  6876. <!-- Box Title -->
  6877. <xsl:text> </xsl:text>
  6878. <span class="caption">
  6879. <xsl:choose>
  6880. <xsl:when test="$anchor != ''">
  6881. <a name="{$anchor}">
  6882. <xsl:value-of select="$caption"/>
  6883. </a>
  6884. </xsl:when>
  6885. <xsl:otherwise>
  6886. <xsl:value-of select="$caption"/>
  6887. </xsl:otherwise>
  6888. </xsl:choose>
  6889. </span>
  6890. </div>
  6891. <!-- Box Contents -->
  6892. <div id="{$id}" class="contents">
  6893. <xsl:copy-of select="$contents"/>
  6894. </div>
  6895. <xsl:if test="normalize-space(translate($useJavaScript,'TRUE','true'))='true'">
  6896. <xsl:call-template name="PrintJSCode">
  6897. <xsl:with-param name="code">setState('<xsl:value-of select="$id"/>', <xsl:value-of select="$isOpened"/>);</xsl:with-param>
  6898. </xsl:call-template>
  6899. </xsl:if>
  6900. </div>
  6901. </xsl:template>
  6902. <!--
  6903. Returns the namespace of an attribute
  6904. declaration or reference.
  6905. Param(s):
  6906. attribute (Node) required
  6907. Attribute declaration or reference
  6908. -->
  6909. <xsl:template name="GetAttributeNS">
  6910. <xsl:param name="attribute"/>
  6911. <xsl:choose>
  6912. <!-- Qualified local attribute declaration -->
  6913. <xsl:when test="$attribute[@name] and (normalize-space(translate($attribute/@form, 'QUALIFED', 'qualifed'))='qualified' or normalize-space(translate(/xsd:schema/@attributeFormDefault, 'QUALIFED', 'qualifed'))='qualified')">
  6914. <xsl:value-of select="/xsd:schema/@targetNamespace"/>
  6915. </xsl:when>
  6916. <!-- Reference to global attribute declaration -->
  6917. <xsl:when test="$attribute[@ref]">
  6918. <xsl:call-template name="GetRefNS">
  6919. <xsl:with-param name="ref" select="$attribute/@ref"/>
  6920. </xsl:call-template>
  6921. </xsl:when>
  6922. <!-- Otherwise, attribute has no namespace -->
  6923. </xsl:choose>
  6924. </xsl:template>
  6925. <!--
  6926. Returns the description that can be used in
  6927. headers for a schema component.
  6928. Param(s):
  6929. component (Node) required
  6930. Schema component
  6931. -->
  6932. <xsl:template name="GetComponentDescription">
  6933. <xsl:param name="component"/>
  6934. <xsl:choose>
  6935. <xsl:when test="local-name($component)='all'">
  6936. <xsl:text>All Model Group</xsl:text>
  6937. </xsl:when>
  6938. <xsl:when test="local-name($component)='attribute'">
  6939. <xsl:text>Attribute</xsl:text>
  6940. </xsl:when>
  6941. <xsl:when test="local-name($component)='attributeGroup'">
  6942. <xsl:text>Attribute Group</xsl:text>
  6943. </xsl:when>
  6944. <xsl:when test="local-name($component)='choice'">
  6945. <xsl:text>Choice Model Group</xsl:text>
  6946. </xsl:when>
  6947. <xsl:when test="local-name($component)='complexType'">
  6948. <xsl:text>Complex Type</xsl:text>
  6949. </xsl:when>
  6950. <xsl:when test="local-name($component)='element'">
  6951. <xsl:text>Element</xsl:text>
  6952. </xsl:when>
  6953. <xsl:when test="local-name($component)='group'">
  6954. <xsl:text>Model Group</xsl:text>
  6955. </xsl:when>
  6956. <xsl:when test="local-name($component)='notation'">
  6957. <xsl:text>Notation</xsl:text>
  6958. </xsl:when>
  6959. <xsl:when test="local-name($component)='sequence'">
  6960. <xsl:text>Sequence Model Group</xsl:text>
  6961. </xsl:when>
  6962. <xsl:when test="local-name($component)='simpleType'">
  6963. <xsl:text>Simple Type</xsl:text>
  6964. </xsl:when>
  6965. <xsl:otherwise>
  6966. <xsl:call-template name="HandleError">
  6967. <xsl:with-param name="isTerminating">true</xsl:with-param>
  6968. <xsl:with-param name="errorMsg">
  6969. Unknown schema component, <xsl:value-of select="local-name($component)"/>.
  6970. </xsl:with-param>
  6971. </xsl:call-template>
  6972. </xsl:otherwise>
  6973. </xsl:choose>
  6974. </xsl:template>
  6975. <!--
  6976. Returns the unique identifier for a top-level schema
  6977. component. Returns the string "schema" if the 'component'
  6978. is the root schema element.
  6979. Param(s):
  6980. component (Node) required
  6981. Schema component
  6982. -->
  6983. <xsl:template name="GetComponentID">
  6984. <xsl:param name="component"/>
  6985. <xsl:choose>
  6986. <xsl:when test="local-name($component)='schema'">
  6987. <xsl:text>schema</xsl:text>
  6988. </xsl:when>
  6989. <xsl:otherwise>
  6990. <xsl:variable name="componentPrefix">
  6991. <xsl:call-template name="GetComponentPrefix">
  6992. <xsl:with-param name="component" select="$component"/>
  6993. </xsl:call-template>
  6994. </xsl:variable>
  6995. <xsl:value-of select="concat($componentPrefix, $component/@name)"/>
  6996. </xsl:otherwise>
  6997. </xsl:choose>
  6998. </xsl:template>
  6999. <!--
  7000. Returns the prefix to add in front of a schema component
  7001. name when generating anchor names.
  7002. Param(s):
  7003. component (Node) required
  7004. Schema component
  7005. -->
  7006. <xsl:template name="GetComponentPrefix">
  7007. <xsl:param name="component"/>
  7008. <xsl:choose>
  7009. <xsl:when test="local-name($component)='attribute'">
  7010. <xsl:value-of select="$ATTR_PREFIX"/>
  7011. </xsl:when>
  7012. <xsl:when test="local-name($component)='attributeGroup'">
  7013. <xsl:value-of select="$ATTR_GRP_PREFIX"/>
  7014. </xsl:when>
  7015. <xsl:when test="local-name($component)='complexType'">
  7016. <xsl:value-of select="$CTYPE_PREFIX"/>
  7017. </xsl:when>
  7018. <xsl:when test="local-name($component)='element'">
  7019. <xsl:value-of select="$ELEM_PREFIX"/>
  7020. </xsl:when>
  7021. <xsl:when test="local-name($component)='group'">
  7022. <xsl:value-of select="$GRP_PREFIX"/>
  7023. </xsl:when>
  7024. <xsl:when test="local-name($component)='notation'">
  7025. <xsl:value-of select="$NOTA_PREFIX"/>
  7026. </xsl:when>
  7027. <xsl:when test="local-name($component)='simpleType'">
  7028. <xsl:value-of select="$STYPE_PREFIX"/>
  7029. </xsl:when>
  7030. <xsl:when test="local-name($component)='key' or local-name($component)='unique'">
  7031. <xsl:value-of select="$KEY_PREFIX"/>
  7032. </xsl:when>
  7033. <xsl:otherwise>
  7034. <xsl:call-template name="HandleError">
  7035. <xsl:with-param name="isTerminating">true</xsl:with-param>
  7036. <xsl:with-param name="errorMsg">
  7037. Unknown schema component, <xsl:value-of select="local-name($component)"/>.
  7038. </xsl:with-param>
  7039. </xsl:call-template>
  7040. </xsl:otherwise>
  7041. </xsl:choose>
  7042. </xsl:template>
  7043. <!--
  7044. Returns a glossary term reference for the
  7045. schema component type, if applicable.
  7046. Param(s):
  7047. component (Node) required
  7048. Schema component
  7049. -->
  7050. <xsl:template name="GetComponentTermRef">
  7051. <xsl:param name="component"/>
  7052. <xsl:choose>
  7053. <xsl:when test="local-name($component)='notation'">
  7054. <xsl:text>Notation</xsl:text>
  7055. </xsl:when>
  7056. </xsl:choose>
  7057. </xsl:template>
  7058. <!--
  7059. Returns the namespace prefix of an attribute.
  7060. Param(s):
  7061. attribute (Node) required
  7062. Attribute declaration or reference
  7063. -->
  7064. <xsl:template name="GetAttributePrefix">
  7065. <xsl:param name="attribute"/>
  7066. <xsl:choose>
  7067. <!-- Element reference -->
  7068. <xsl:when test="$attribute/@ref">
  7069. <xsl:call-template name="GetRefPrefix">
  7070. <xsl:with-param name="ref" select="$attribute/@ref"/>
  7071. </xsl:call-template>
  7072. </xsl:when>
  7073. <!-- Global element declaration -->
  7074. <xsl:when test="local-name($attribute/..)='schema'">
  7075. <xsl:call-template name="GetThisPrefix"/>
  7076. </xsl:when>
  7077. <!-- Local element declaration -->
  7078. <xsl:otherwise>
  7079. <xsl:if test="($attribute/@form and normalize-space($attribute/@form)='qualified') or (/xsd:schema/@attributeFormDefault and normalize-space(/xsd:schema/@attributeFormDefault)='qualified')">
  7080. <xsl:call-template name="GetThisPrefix"/>
  7081. </xsl:if>
  7082. </xsl:otherwise>
  7083. </xsl:choose>
  7084. </xsl:template>
  7085. <!--
  7086. Returns the namespace prefix of an element.
  7087. Param(s):
  7088. element (Node) required
  7089. Element declaration or reference
  7090. -->
  7091. <xsl:template name="GetElementPrefix">
  7092. <xsl:param name="element"/>
  7093. <xsl:choose>
  7094. <!-- Element reference -->
  7095. <xsl:when test="$element/@ref">
  7096. <xsl:call-template name="GetRefPrefix">
  7097. <xsl:with-param name="ref" select="$element/@ref"/>
  7098. </xsl:call-template>
  7099. </xsl:when>
  7100. <!-- Global element declaration -->
  7101. <xsl:when test="local-name($element/..)='schema'">
  7102. <xsl:call-template name="GetThisPrefix"/>
  7103. </xsl:when>
  7104. <!-- Local element declaration -->
  7105. <xsl:otherwise>
  7106. <xsl:if test="($element/@form and normalize-space($element/@form)='qualified') or (/xsd:schema/@elementFormDefault and normalize-space(/xsd:schema/@elementFormDefault)='qualified')">
  7107. <xsl:call-template name="GetThisPrefix"/>
  7108. </xsl:if>
  7109. </xsl:otherwise>
  7110. </xsl:choose>
  7111. </xsl:template>
  7112. <!--
  7113. Returns the local name of a reference.
  7114. Param(s):
  7115. ref (String) required
  7116. Reference
  7117. -->
  7118. <xsl:template name="GetRefName">
  7119. <xsl:param name="ref"/>
  7120. <xsl:choose>
  7121. <xsl:when test="contains($ref, ':')">
  7122. <!-- Ref has namespace prefix -->
  7123. <xsl:value-of select="substring-after($ref, ':')"/>
  7124. </xsl:when>
  7125. <xsl:otherwise>
  7126. <!-- Ref has no namespace prefix -->
  7127. <xsl:value-of select="$ref"/>
  7128. </xsl:otherwise>
  7129. </xsl:choose>
  7130. </xsl:template>
  7131. <!--
  7132. Returns the namespace prefix of a reference.
  7133. Param(s):
  7134. ref (String) required
  7135. Reference
  7136. -->
  7137. <xsl:template name="GetRefPrefix">
  7138. <xsl:param name="ref"/>
  7139. <!-- Get namespace prefix -->
  7140. <xsl:value-of select="substring-before($ref, ':')"/>
  7141. </xsl:template>
  7142. <!--
  7143. Returns the namespace of a reference.
  7144. Param(s):
  7145. ref (String) required
  7146. Reference
  7147. -->
  7148. <xsl:template name="GetRefNS">
  7149. <xsl:param name="ref"/>
  7150. <!-- Get namespace prefix -->
  7151. <xsl:variable name="refPrefix" select="substring-before($ref, ':')"/>
  7152. <!-- Get namespace -->
  7153. <xsl:value-of select="/xsd:schema/namespace::*[local-name(.)=normalize-space($refPrefix)]"/>
  7154. </xsl:template>
  7155. <!--
  7156. Returns the declared prefix of this schema's target namespace.
  7157. -->
  7158. <xsl:template name="GetThisPrefix">
  7159. <xsl:if test="/xsd:schema/@targetNamespace">
  7160. <xsl:value-of select="local-name(/xsd:schema/namespace::*[normalize-space(.)=normalize-space(/xsd:schema/@targetNamespace)])"/>
  7161. </xsl:if>
  7162. </xsl:template>
  7163. <!--
  7164. Returns the declared prefix of XML Schema namespace.
  7165. -->
  7166. <xsl:template name="GetXSDPrefix">
  7167. <xsl:value-of select="local-name(/xsd:schema/namespace::*[normalize-space(.)=$XSD_NS])"/>
  7168. </xsl:template>
  7169. <!--
  7170. Returns the schema documentation file location for a
  7171. given URI for a schema, done by looking up the file
  7172. specified in 'linksFile' variable.
  7173. It'll throw a fatal error if a value for 'linksFile' was
  7174. provided and the documentation file for 'uri' could not be
  7175. found.
  7176. Param(s):
  7177. uri (String) required
  7178. Location of schema file
  7179. -->
  7180. <xsl:template name="GetSchemaDocLocation">
  7181. <xsl:param name="uri"/>
  7182. <xsl:if test="$linksFile!=''">
  7183. <xsl:variable name="schemaDocFile" select="document($linksFile)/ppp:links/ppp:schema[@file-location=$uri]/@docfile-location"/>
  7184. <xsl:if test="$schemaDocFile=''">
  7185. <xsl:call-template name="HandleError">
  7186. <xsl:with-param name="isTerminating">true</xsl:with-param>
  7187. <xsl:with-param name="errorMsg">
  7188. Documentation file for the schema at, <xsl:value-of select="$uri"/>,
  7189. was not specified in the links file, <xsl:value-of select="$linksFile"/>.
  7190. </xsl:with-param>
  7191. </xsl:call-template>
  7192. </xsl:if>
  7193. <xsl:value-of select="$schemaDocFile"/>
  7194. </xsl:if>
  7195. </xsl:template>
  7196. <!--
  7197. Prints out a boolean value.
  7198. Param(s):
  7199. boolean (String) required
  7200. Boolean value
  7201. -->
  7202. <xsl:template name="PrintBoolean">
  7203. <xsl:param name="boolean"/>
  7204. <xsl:choose>
  7205. <xsl:when test="normalize-space(translate($boolean,'TRUE', 'true'))='true' or normalize-space($boolean)='1'">
  7206. <xsl:text>yes</xsl:text>
  7207. </xsl:when>
  7208. <xsl:otherwise>
  7209. <xsl:text>no</xsl:text>
  7210. </xsl:otherwise>
  7211. </xsl:choose>
  7212. </xsl:template>
  7213. <!--
  7214. Prints out a link to the namespace of a prefix,
  7215. and tacks on a colon in the end.
  7216. Param(s):
  7217. prefix (String) required
  7218. Namespace prefix
  7219. nolink (boolean) optional
  7220. If true, doesn't provide a link to the
  7221. namespace in the namespaces table.
  7222. schemaLoc (String) optional
  7223. Schema file containing this namespace prefix;
  7224. if in current schema, 'schemaLoc' is set to 'this'
  7225. -->
  7226. <xsl:template name="PrintNSPrefix">
  7227. <xsl:param name="prefix"/>
  7228. <xsl:param name="nolink">false</xsl:param>
  7229. <xsl:param name="schemaLoc">this</xsl:param>
  7230. <xsl:if test="$prefix!='' and normalize-space(translate($printNSPrefixes,'TRUE','true'))='true'">
  7231. <xsl:choose>
  7232. <xsl:when test="$nolink='false'">
  7233. <xsl:call-template name="PrintNamespaceRef">
  7234. <xsl:with-param name="prefix" select="$prefix"/>
  7235. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  7236. </xsl:call-template>
  7237. </xsl:when>
  7238. <xsl:otherwise>
  7239. <xsl:value-of select="$prefix"/>
  7240. </xsl:otherwise>
  7241. </xsl:choose>
  7242. <xsl:text>:</xsl:text>
  7243. </xsl:if>
  7244. </xsl:template>
  7245. <!--
  7246. Prints out the min/max occurrences of a schema component.
  7247. Param(s):
  7248. component (Node) optional
  7249. Schema component
  7250. minOccurs (String) optional
  7251. Minimum occurrences
  7252. maxOccurs (String) optional
  7253. Maximum occurrences
  7254. -->
  7255. <xsl:template name="PrintOccurs">
  7256. <xsl:param name="component"/>
  7257. <xsl:param name="minOccurs"/>
  7258. <xsl:param name="maxOccurs"/>
  7259. <!-- Get min occurs -->
  7260. <xsl:variable name="min">
  7261. <xsl:choose>
  7262. <xsl:when test="$component and local-name($component)='attribute'">
  7263. <xsl:choose>
  7264. <xsl:when test="normalize-space($component/@use)='required'">
  7265. <xsl:text>1</xsl:text>
  7266. </xsl:when>
  7267. <xsl:otherwise>
  7268. <xsl:text>0</xsl:text>
  7269. </xsl:otherwise>
  7270. </xsl:choose>
  7271. </xsl:when>
  7272. <xsl:otherwise>
  7273. <xsl:choose>
  7274. <xsl:when test="$component and $component/@minOccurs">
  7275. <xsl:value-of select="$component/@minOccurs"/>
  7276. </xsl:when>
  7277. <xsl:when test="$minOccurs != ''">
  7278. <xsl:value-of select="$minOccurs"/>
  7279. </xsl:when>
  7280. <xsl:otherwise>
  7281. <xsl:text>1</xsl:text>
  7282. </xsl:otherwise>
  7283. </xsl:choose>
  7284. </xsl:otherwise>
  7285. </xsl:choose>
  7286. </xsl:variable>
  7287. <!-- Get max occurs -->
  7288. <xsl:variable name="max">
  7289. <xsl:choose>
  7290. <xsl:when test="$component and local-name($component)='attribute'">
  7291. <xsl:choose>
  7292. <xsl:when test="normalize-space($component/@use)='prohibited'">
  7293. <xsl:text>0</xsl:text>
  7294. </xsl:when>
  7295. <xsl:otherwise>
  7296. <xsl:text>1</xsl:text>
  7297. </xsl:otherwise>
  7298. </xsl:choose>
  7299. </xsl:when>
  7300. <xsl:otherwise>
  7301. <xsl:choose>
  7302. <xsl:when test="($component and normalize-space($component/@maxOccurs)='unbounded') or $maxOccurs='unbounded'">
  7303. <xsl:text>*</xsl:text>
  7304. </xsl:when>
  7305. <xsl:when test="$component and $component/@maxOccurs">
  7306. <xsl:value-of select="$component/@maxOccurs"/>
  7307. </xsl:when>
  7308. <xsl:when test="$maxOccurs != ''">
  7309. <xsl:value-of select="$maxOccurs"/>
  7310. </xsl:when>
  7311. <xsl:otherwise>
  7312. <xsl:text>1</xsl:text>
  7313. </xsl:otherwise>
  7314. </xsl:choose>
  7315. </xsl:otherwise>
  7316. </xsl:choose>
  7317. </xsl:variable>
  7318. <span class="occurs">
  7319. <xsl:choose>
  7320. <xsl:when test="number($min)=1 and number($max)=1">
  7321. <xsl:text>[1]</xsl:text>
  7322. </xsl:when>
  7323. <xsl:otherwise>
  7324. <xsl:text>[</xsl:text>
  7325. <xsl:value-of select="$min"/>
  7326. <xsl:text>..</xsl:text>
  7327. <xsl:value-of select="$max"/>
  7328. <xsl:text>]</xsl:text>
  7329. </xsl:otherwise>
  7330. </xsl:choose>
  7331. </span>
  7332. </xsl:template>
  7333. <!--
  7334. Translates occurrence of '#all' in 'block' value
  7335. of element declarations.
  7336. Param(s):
  7337. EBV (String) required
  7338. Value
  7339. -->
  7340. <xsl:template name="PrintBlockSet">
  7341. <xsl:param name="EBV"/>
  7342. <xsl:choose>
  7343. <xsl:when test="normalize-space($EBV)='#all'">
  7344. <xsl:text>restriction, extension, substitution</xsl:text>
  7345. </xsl:when>
  7346. <xsl:otherwise>
  7347. <xsl:value-of select="$EBV"/>
  7348. </xsl:otherwise>
  7349. </xsl:choose>
  7350. </xsl:template>
  7351. <!--
  7352. Translates occurrence of '#all' in 'final' value
  7353. of element declarations, and 'block' and 'final' values
  7354. in complex type definitions.
  7355. Param(s):
  7356. EBV (String) required
  7357. Value
  7358. -->
  7359. <xsl:template name="PrintDerivationSet">
  7360. <xsl:param name="EBV"/>
  7361. <xsl:choose>
  7362. <xsl:when test="normalize-space($EBV)='#all'">
  7363. <xsl:text>restriction, extension</xsl:text>
  7364. </xsl:when>
  7365. <xsl:otherwise>
  7366. <xsl:value-of select="$EBV"/>
  7367. </xsl:otherwise>
  7368. </xsl:choose>
  7369. </xsl:template>
  7370. <!--
  7371. Translates occurrence of '#all' in 'final' value
  7372. of simple type definitions.
  7373. Param(s):
  7374. EBV (String) required
  7375. Value
  7376. -->
  7377. <xsl:template name="PrintSimpleDerivationSet">
  7378. <xsl:param name="EBV"/>
  7379. <xsl:choose>
  7380. <xsl:when test="normalize-space($EBV)='#all'">
  7381. <xsl:text>restriction, list, union</xsl:text>
  7382. </xsl:when>
  7383. <xsl:when test="normalize-space($EBV)!=''">
  7384. <xsl:value-of select="$EBV"/>
  7385. </xsl:when>
  7386. </xsl:choose>
  7387. </xsl:template>
  7388. <!--
  7389. Print out a URI. If it starts with 'http', a link is provided.
  7390. Param(s):
  7391. uri (String) required
  7392. URI to be printed
  7393. -->
  7394. <xsl:template name="PrintURI">
  7395. <xsl:param name="uri"/>
  7396. <xsl:choose>
  7397. <xsl:when test="starts-with($uri, 'http')">
  7398. <a title="{$uri}" href="{$uri}">
  7399. <xsl:value-of select="$uri"/>
  7400. </a>
  7401. </xsl:when>
  7402. <xsl:otherwise>
  7403. <xsl:value-of select="$uri"/>
  7404. </xsl:otherwise>
  7405. </xsl:choose>
  7406. </xsl:template>
  7407. <!--
  7408. Print out a link to the documentation of schema document.
  7409. For this happen, the 'linksFile' variable must be provided,
  7410. it must point to an actual file, and in that file, there
  7411. must be a mapping from the schema file location to the
  7412. schema documentation file location.
  7413. Param(s):
  7414. uri (String) required
  7415. Location of schema file
  7416. -->
  7417. <xsl:template name="PrintSchemaLink">
  7418. <xsl:param name="uri"/>
  7419. <xsl:variable name="docFileLoc">
  7420. <xsl:call-template name="GetSchemaDocLocation">
  7421. <xsl:with-param name="uri" select="$uri"/>
  7422. </xsl:call-template>
  7423. </xsl:variable>
  7424. <xsl:choose>
  7425. <xsl:when test="$docFileLoc!=''">
  7426. <a title="Jump to schema documentation for '{$uri}'." href="{$docFileLoc}">
  7427. <xsl:value-of select="$uri"/>
  7428. </a>
  7429. </xsl:when>
  7430. <xsl:otherwise>
  7431. <xsl:value-of select="$uri"/>
  7432. </xsl:otherwise>
  7433. </xsl:choose>
  7434. </xsl:template>
  7435. <!--
  7436. Tokenises a whitespace-separated list of values, and
  7437. displays them appropriately.
  7438. Param(s):
  7439. value (String) required
  7440. Whitespace-separated list
  7441. compType (String) optional
  7442. Specify schema component type if values in list are
  7443. schema components, so appropriate links can be provided.
  7444. isInList (boolean) optional
  7445. If true, place each value within 'li' tags.
  7446. Assumes that this template is called within an HTML
  7447. list element.
  7448. separator (String) optional
  7449. Character(s) to use to separate resulting values in list.
  7450. Only used if 'isInList' is false.
  7451. If none is provided, uses a space character, ' '.
  7452. isFirst (boolean) optional
  7453. If false, it's a recursive call from 'PrintWhitespaceList'.
  7454. schemaLoc (String) optional
  7455. Schema file containing this all model group;
  7456. if in current schema, 'schemaLoc' is set to 'this'
  7457. -->
  7458. <xsl:template name="PrintWhitespaceList">
  7459. <xsl:param name="value"/>
  7460. <xsl:param name="compType"/>
  7461. <xsl:param name="isInList">false</xsl:param>
  7462. <xsl:param name="separator"/>
  7463. <xsl:param name="isFirst">true</xsl:param>
  7464. <xsl:param name="schemaLoc">this</xsl:param>
  7465. <xsl:variable name="token" select="normalize-space(substring-before($value, ' '))"/>
  7466. <xsl:choose>
  7467. <xsl:when test="$token!=''">
  7468. <!-- Whitespace found in value -->
  7469. <!-- Print out token -->
  7470. <xsl:call-template name="PrintWhitespaceListToken">
  7471. <xsl:with-param name="token" select="$token"/>
  7472. <xsl:with-param name="compType" select="$compType"/>
  7473. <xsl:with-param name="isInList" select="$isInList"/>
  7474. <xsl:with-param name="separator" select="$separator"/>
  7475. <xsl:with-param name="isFirst" select="$isFirst"/>
  7476. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  7477. </xsl:call-template>
  7478. <!-- Continue parsing -->
  7479. <xsl:variable name="rest" select="normalize-space(substring-after($value, $token))"/>
  7480. <xsl:if test="$rest!=''">
  7481. <xsl:call-template name="PrintWhitespaceList">
  7482. <xsl:with-param name="value" select="$rest"/>
  7483. <xsl:with-param name="compType" select="$compType"/>
  7484. <xsl:with-param name="isInList" select="$isInList"/>
  7485. <xsl:with-param name="separator" select="$separator"/>
  7486. <xsl:with-param name="isFirst">false</xsl:with-param>
  7487. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  7488. </xsl:call-template>
  7489. </xsl:if>
  7490. </xsl:when>
  7491. <xsl:otherwise>
  7492. <!-- No more whitespaces -->
  7493. <!-- Print out one last token -->
  7494. <xsl:if test="normalize-space($value)!=''">
  7495. <xsl:call-template name="PrintWhitespaceListToken">
  7496. <xsl:with-param name="token" select="$value"/>
  7497. <xsl:with-param name="compType" select="$compType"/>
  7498. <xsl:with-param name="isInList" select="$isInList"/>
  7499. <xsl:with-param name="separator" select="$separator"/>
  7500. <xsl:with-param name="isFirst" select="$isFirst"/>
  7501. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  7502. </xsl:call-template>
  7503. </xsl:if>
  7504. </xsl:otherwise>
  7505. </xsl:choose>
  7506. </xsl:template>
  7507. <!--
  7508. Helper template for 'PrintWhitespaceList' template,
  7509. which prints out one token in the list.
  7510. Param(s):
  7511. token (String) required
  7512. Token to be printed
  7513. compType (String) optional
  7514. Schema component type of token, if applicable.
  7515. isInList (boolean) optional
  7516. If true, place token within 'li' tags.
  7517. separator (String) optional
  7518. Character(s) use to separate one token from another.
  7519. Only used if 'isInList' is false.
  7520. If none is provided, uses a space character, ' '.
  7521. isFirst (boolean) optional
  7522. If true, token is the first value in the list.
  7523. schemaLoc (String) optional
  7524. Schema file containing this all model group;
  7525. if in current schema, 'schemaLoc' is set to 'this'
  7526. -->
  7527. <xsl:template name="PrintWhitespaceListToken">
  7528. <xsl:param name="token"/>
  7529. <xsl:param name="compType"/>
  7530. <xsl:param name="isInList">false</xsl:param>
  7531. <xsl:param name="separator"/>
  7532. <xsl:param name="isFirst">true</xsl:param>
  7533. <xsl:param name="schemaLoc">this</xsl:param>
  7534. <xsl:variable name="displayValue">
  7535. <xsl:choose>
  7536. <xsl:when test="$compType!=''">
  7537. <xsl:call-template name="PrintCompRef">
  7538. <xsl:with-param name="ref" select="normalize-space($token)"/>
  7539. <xsl:with-param name="compType" select="$compType"/>
  7540. <xsl:with-param name="schemaLoc" select="$schemaLoc"/>
  7541. </xsl:call-template>
  7542. </xsl:when>
  7543. <xsl:otherwise>
  7544. <xsl:value-of select="normalize-space($token)"/>
  7545. </xsl:otherwise>
  7546. </xsl:choose>
  7547. </xsl:variable>
  7548. <xsl:choose>
  7549. <xsl:when test="$isInList!='false'">
  7550. <li>
  7551. <xsl:copy-of select="$displayValue"/>
  7552. </li>
  7553. </xsl:when>
  7554. <xsl:when test="$isFirst!='true'">
  7555. <xsl:choose>
  7556. <xsl:when test="$separator!=''">
  7557. <xsl:value-of select="$separator"/>
  7558. </xsl:when>
  7559. <xsl:otherwise>
  7560. <xsl:text> </xsl:text>
  7561. </xsl:otherwise>
  7562. </xsl:choose>
  7563. <xsl:copy-of select="$displayValue"/>
  7564. </xsl:when>
  7565. <xsl:otherwise>
  7566. <xsl:copy-of select="$displayValue"/>
  7567. </xsl:otherwise>
  7568. </xsl:choose>
  7569. </xsl:template>
  7570. <!--
  7571. Print out a wildcard.
  7572. Param(s):
  7573. componentType (attribute|element) required
  7574. XML Schema component type
  7575. namespaces (String) required
  7576. Namespace attribute of wildcard
  7577. processContents (String) required
  7578. Process contents attribute of wildcard
  7579. namespaces (String) required
  7580. Namespace attribute of wildcard
  7581. -->
  7582. <xsl:template name="PrintWildcard">
  7583. <xsl:param name="componentType">element</xsl:param>
  7584. <xsl:param name="namespace"/>
  7585. <xsl:param name="processContents"/>
  7586. <xsl:param name="minOccurs"/>
  7587. <xsl:param name="maxOccurs"/>
  7588. <xsl:text>Allow any </xsl:text>
  7589. <xsl:value-of select="$componentType"/>
  7590. <xsl:text>s from </xsl:text>
  7591. <xsl:choose>
  7592. <!-- ##any -->
  7593. <xsl:when test="not($namespace) or normalize-space($namespace)='##any'">
  7594. <xsl:text>any namespace</xsl:text>
  7595. </xsl:when>
  7596. <!-- ##other -->
  7597. <xsl:when test="normalize-space($namespace)='##other'">
  7598. <xsl:text>a namespace other than this schema's namespace</xsl:text>
  7599. </xsl:when>
  7600. <!-- ##targetNamespace, ##local, specific namespaces -->
  7601. <xsl:otherwise>
  7602. <!-- ##targetNamespace -->
  7603. <xsl:variable name="hasTargetNS">
  7604. <xsl:if test="contains($namespace, '##targetNamespace')">
  7605. <xsl:text>true</xsl:text>
  7606. </xsl:if>
  7607. </xsl:variable>
  7608. <!-- ##local -->
  7609. <xsl:variable name="hasLocalNS">
  7610. <xsl:if test="contains($namespace, '##local')">
  7611. <xsl:text>true</xsl:text>
  7612. </xsl:if>
  7613. </xsl:variable>
  7614. <!-- Specific namespaces -->
  7615. <!-- Remove '##targetNamespace' string if any-->
  7616. <xsl:variable name="temp">
  7617. <xsl:choose>
  7618. <xsl:when test="$hasTargetNS='true'">
  7619. <xsl:value-of select="concat(substring-before($namespace, '##targetNamespace'), substring-after($namespace, '##targetNamespace'))"/>
  7620. </xsl:when>
  7621. <xsl:otherwise>
  7622. <xsl:value-of select="$namespace"/>
  7623. </xsl:otherwise>
  7624. </xsl:choose>
  7625. </xsl:variable>
  7626. <!-- Remove '##local' string if any -->
  7627. <xsl:variable name="specificNS">
  7628. <xsl:choose>
  7629. <xsl:when test="$hasLocalNS='true'">
  7630. <xsl:value-of select="concat(substring-before($temp, '##local'), substring-after($temp, '##local'))"/>
  7631. </xsl:when>
  7632. <xsl:otherwise>
  7633. <xsl:value-of select="$temp"/>
  7634. </xsl:otherwise>
  7635. </xsl:choose>
  7636. </xsl:variable>
  7637. <xsl:variable name="hasSpecificNS">
  7638. <xsl:if test="normalize-space($specificNS)!=''">
  7639. <xsl:text>true</xsl:text>
  7640. </xsl:if>
  7641. </xsl:variable>
  7642. <xsl:if test="$hasLocalNS='true'">
  7643. <xsl:text>no namespace</xsl:text>
  7644. </xsl:if>
  7645. <xsl:if test="$hasTargetNS='true'">
  7646. <xsl:choose>
  7647. <xsl:when test="$hasLocalNS='true' and $hasSpecificNS!='true'">
  7648. <xsl:text> and </xsl:text>
  7649. </xsl:when>
  7650. <xsl:when test="$hasLocalNS='true'">
  7651. <xsl:text>, </xsl:text>
  7652. </xsl:when>
  7653. </xsl:choose>
  7654. <xsl:text>this schema's namespace</xsl:text>
  7655. </xsl:if>
  7656. <xsl:if test="$hasSpecificNS='true'">
  7657. <xsl:choose>
  7658. <xsl:when test="$hasTargetNS='true' and $hasLocalNS='true'">
  7659. <xsl:text>, and </xsl:text>
  7660. </xsl:when>
  7661. <xsl:when test="$hasTargetNS='true' or $hasLocalNS='true'">
  7662. <xsl:text> and </xsl:text>
  7663. </xsl:when>
  7664. </xsl:choose>
  7665. <xsl:text>the following namespace(s): </xsl:text>
  7666. <xsl:call-template name="PrintWhitespaceList">
  7667. <xsl:with-param name="value" select="normalize-space($specificNS)"/>
  7668. <xsl:with-param name="separator">,</xsl:with-param>
  7669. </xsl:call-template>
  7670. </xsl:if>
  7671. </xsl:otherwise>
  7672. </xsl:choose>
  7673. <!-- Process contents -->
  7674. <xsl:text> (</xsl:text>
  7675. <xsl:choose>
  7676. <xsl:when test="$processContents">
  7677. <xsl:value-of select="normalize-space($processContents)"/>
  7678. </xsl:when>
  7679. <xsl:otherwise>
  7680. <xsl:text>strict</xsl:text>
  7681. </xsl:otherwise>
  7682. </xsl:choose>
  7683. <xsl:text> validation)</xsl:text>
  7684. <xsl:text>.</xsl:text>
  7685. <!-- Print min/max occurs -->
  7686. <xsl:if test="$componentType='element'">
  7687. <xsl:text> </xsl:text>
  7688. <xsl:call-template name="PrintOccurs">
  7689. <xsl:with-param name="minOccurs" select="$minOccurs"/>
  7690. <xsl:with-param name="maxOccurs" select="$maxOccurs"/>
  7691. </xsl:call-template>
  7692. </xsl:if>
  7693. </xsl:template>
  7694. <!--
  7695. Print out the pattern property for derivations by
  7696. restriction on simple content.
  7697. Param(s):
  7698. simpleRestrict (Node) required
  7699. 'restriction' element
  7700. -->
  7701. <xsl:template name="PrintPatternFacet">
  7702. <xsl:param name="simpleRestrict"/>
  7703. <xsl:if test="$simpleRestrict/xsd:pattern">
  7704. <em>pattern</em>
  7705. <xsl:text> = </xsl:text>
  7706. <xsl:value-of select="$simpleRestrict/xsd:pattern/@value"/>
  7707. </xsl:if>
  7708. </xsl:template>
  7709. <!--
  7710. Print out the total digits property for derivations by
  7711. restriction on simple content.
  7712. Param(s):
  7713. simpleRestrict (Node) required
  7714. 'restriction' element
  7715. -->
  7716. <xsl:template name="PrintTotalDigitsFacet">
  7717. <xsl:param name="simpleRestrict"/>
  7718. <xsl:if test="$simpleRestrict/xsd:totalDigits">
  7719. <em>total no. of digits</em>
  7720. <xsl:text> = </xsl:text>
  7721. <xsl:value-of select="$simpleRestrict/xsd:totalDigits/@value"/>
  7722. </xsl:if>
  7723. </xsl:template>
  7724. <!--
  7725. Print out the fraction digits property for derivations by
  7726. restriction on simple content.
  7727. Param(s):
  7728. simpleRestrict (Node) required
  7729. 'restriction' element
  7730. -->
  7731. <xsl:template name="PrintFractionDigitsFacet">
  7732. <xsl:param name="simpleRestrict"/>
  7733. <xsl:if test="$simpleRestrict/xsd:fractionDigits">
  7734. <em>
  7735. <xsl:text>no. of fraction digits</xsl:text>
  7736. </em>
  7737. <xsl:text> = </xsl:text>
  7738. <xsl:value-of select="$simpleRestrict/xsd:fractionDigits/@value"/>
  7739. </xsl:if>
  7740. </xsl:template>
  7741. <!--
  7742. Print out the enumeration list for derivations by
  7743. restriction on simple content.
  7744. Param(s):
  7745. simpleRestrict (Node) required
  7746. 'restriction' element
  7747. -->
  7748. <xsl:template name="PrintEnumFacets">
  7749. <xsl:param name="simpleRestrict"/>
  7750. <xsl:if test="$simpleRestrict/xsd:enumeration">
  7751. <em>value</em>
  7752. <xsl:text> comes from list: {</xsl:text>
  7753. <xsl:for-each select="$simpleRestrict/xsd:enumeration">
  7754. <xsl:if test="position()!=1">
  7755. <xsl:text>|</xsl:text>
  7756. </xsl:if>
  7757. <xsl:text>'</xsl:text>
  7758. <xsl:value-of select="@value"/>
  7759. <xsl:text>'</xsl:text>
  7760. </xsl:for-each>
  7761. <xsl:text>}</xsl:text>
  7762. </xsl:if>
  7763. </xsl:template>
  7764. <!--
  7765. Print out the length property for derivations by
  7766. restriction on simple content.
  7767. Param(s):
  7768. simpleRestrict (Node) required
  7769. 'restriction' element
  7770. -->
  7771. <xsl:template name="PrintLengthFacets">
  7772. <xsl:param name="simpleRestrict"/>
  7773. <xsl:choose>
  7774. <xsl:when test="$simpleRestrict/xsd:length">
  7775. <em>
  7776. <xsl:text>length</xsl:text>
  7777. </em>
  7778. <xsl:text> = </xsl:text>
  7779. <xsl:value-of select="$simpleRestrict/xsd:length/@value"/>
  7780. </xsl:when>
  7781. <xsl:when test="$simpleRestrict/xsd:minLength">
  7782. <em>
  7783. <xsl:text>length</xsl:text>
  7784. </em>
  7785. <xsl:text> >= </xsl:text>
  7786. <xsl:value-of select="$simpleRestrict/xsd:minLength/@value"/>
  7787. </xsl:when>
  7788. <xsl:when test="$simpleRestrict/xsd:maxLength">
  7789. <em>
  7790. <xsl:text>length</xsl:text>
  7791. </em>
  7792. <xsl:text> &lt;= </xsl:text>
  7793. <xsl:value-of select="$simpleRestrict/xsd:maxLength/@value"/>
  7794. </xsl:when>
  7795. </xsl:choose>
  7796. </xsl:template>
  7797. <!--
  7798. Print out the whitespace property for derivations by
  7799. restriction on simple content.
  7800. Param(s):
  7801. simpleRestrict (Node) required
  7802. 'restriction' element
  7803. -->
  7804. <xsl:template name="PrintWhitespaceFacet">
  7805. <xsl:param name="simpleRestrict"/>
  7806. <xsl:variable name="facetValue" select="normalize-space(translate($simpleRestrict/xsd:whiteSpace/@value, 'ACELOPRSV', 'aceloprsv'))"/>
  7807. <xsl:choose>
  7808. <xsl:when test="$facetValue='preserve'">
  7809. <em>Whitespace policy: </em>
  7810. <xsl:call-template name="PrintGlossaryTermRef">
  7811. <xsl:with-param name="code">PreserveWS</xsl:with-param>
  7812. <xsl:with-param name="term">preserve</xsl:with-param>
  7813. </xsl:call-template>
  7814. </xsl:when>
  7815. <xsl:when test="$facetValue='replace'">
  7816. <em>Whitespace policy: </em>
  7817. <xsl:call-template name="PrintGlossaryTermRef">
  7818. <xsl:with-param name="code">ReplaceWS</xsl:with-param>
  7819. <xsl:with-param name="term">replace</xsl:with-param>
  7820. </xsl:call-template>
  7821. </xsl:when>
  7822. <xsl:when test="$facetValue='collapse'">
  7823. <em>Whitespace policy: </em>
  7824. <xsl:call-template name="PrintGlossaryTermRef">
  7825. <xsl:with-param name="code">CollapseWS</xsl:with-param>
  7826. <xsl:with-param name="term">collapse</xsl:with-param>
  7827. </xsl:call-template>
  7828. </xsl:when>
  7829. </xsl:choose>
  7830. </xsl:template>
  7831. <!--
  7832. Print out the value ranges for derivations by
  7833. restriction on simple content.
  7834. Param(s):
  7835. simpleRestrict (Node) required
  7836. 'restriction' element
  7837. -->
  7838. <xsl:template name="PrintRangeFacets">
  7839. <xsl:param name="simpleRestrict"/>
  7840. <xsl:choose>
  7841. <xsl:when test="($simpleRestrict/xsd:minInclusive or $simpleRestrict/xsd:minExclusive) and ($simpleRestrict/xsd:maxInclusive or $simpleRestrict/xsd:maxExclusive)">
  7842. <xsl:choose>
  7843. <xsl:when test="$simpleRestrict/xsd:minInclusive">
  7844. <xsl:value-of select="$simpleRestrict/xsd:minInclusive/@value"/>
  7845. <xsl:text> &lt;= </xsl:text>
  7846. </xsl:when>
  7847. <xsl:otherwise>
  7848. <xsl:value-of select="$simpleRestrict/xsd:minExclusive/@value"/>
  7849. <xsl:text> &lt; </xsl:text>
  7850. </xsl:otherwise>
  7851. </xsl:choose>
  7852. <em>
  7853. <xsl:text>value</xsl:text>
  7854. </em>
  7855. <xsl:choose>
  7856. <xsl:when test="$simpleRestrict/xsd:maxInclusive">
  7857. <xsl:text> &lt;= </xsl:text>
  7858. <xsl:value-of select="$simpleRestrict/xsd:maxInclusive/@value"/>
  7859. </xsl:when>
  7860. <xsl:otherwise>
  7861. <xsl:text> &lt; </xsl:text>
  7862. <xsl:value-of select="$simpleRestrict/xsd:maxExclusive/@value"/>
  7863. </xsl:otherwise>
  7864. </xsl:choose>
  7865. </xsl:when>
  7866. <xsl:when test="$simpleRestrict/xsd:minInclusive">
  7867. <em>
  7868. <xsl:text>value</xsl:text>
  7869. </em>
  7870. <xsl:text> >= </xsl:text>
  7871. <xsl:value-of select="$simpleRestrict/xsd:minInclusive/@value"/>
  7872. </xsl:when>
  7873. <xsl:when test="$simpleRestrict/xsd:minExclusive">
  7874. <em>
  7875. <xsl:text>value</xsl:text>
  7876. </em>
  7877. <xsl:text> > </xsl:text>
  7878. <xsl:value-of select="$simpleRestrict/xsd:minExclusive/@value"/>
  7879. </xsl:when>
  7880. <xsl:when test="$simpleRestrict/xsd:maxInclusive">
  7881. <em>
  7882. <xsl:text>value</xsl:text>
  7883. </em>
  7884. <xsl:text> &lt;= </xsl:text>
  7885. <xsl:value-of select="$simpleRestrict/xsd:maxInclusive/@value"/>
  7886. </xsl:when>
  7887. <xsl:when test="$simpleRestrict/xsd:maxExclusive">
  7888. <em>
  7889. <xsl:text>value</xsl:text>
  7890. </em>
  7891. <xsl:text> &lt; </xsl:text>
  7892. <xsl:value-of select="$simpleRestrict/xsd:maxExclusive/@value"/>
  7893. </xsl:when>
  7894. </xsl:choose>
  7895. </xsl:template>
  7896. <!--
  7897. Prints out JavaScript code.
  7898. NOTE: Javascript code is placed within comments to make it
  7899. work with current browsers. In strict XHTML, JavaScript code
  7900. should be placed within CDATA sections. However, most
  7901. browsers generate a syntax error if the page contains
  7902. CDATA sections. Placing Javascript code within comments
  7903. means that the code cannot contain two dashes.
  7904. Param(s):
  7905. code (Result Tree Fragment) required
  7906. Javascript code
  7907. -->
  7908. <xsl:template name="PrintJSCode">
  7909. <xsl:param name="code"/>
  7910. <script type="text/javascript">
  7911. <!-- If browsers start supporting CDATA sections,
  7912. uncomment the following piece of code. -->
  7913. <!-- <xsl:text disable-output-escaping="yes">
  7914. &lt;![CDATA[
  7915. </xsl:text> -->
  7916. <!-- If browsers start supporting CDATA sections,
  7917. remove the following piece of code. -->
  7918. <xsl:text disable-output-escaping="yes">
  7919. &lt;!--
  7920. </xsl:text>
  7921. <xsl:value-of select="$code" disable-output-escaping="yes"/>
  7922. <!-- If browsers start supporting CDATA sections,
  7923. remove the following piece of code. -->
  7924. <xsl:text disable-output-escaping="yes">
  7925. // --&gt;
  7926. </xsl:text>
  7927. <!-- If browsers start supporting CDATA sections,
  7928. uncomment the following piece of code. -->
  7929. <!-- <xsl:text disable-output-escaping="yes">
  7930. ]]&gt;
  7931. </xsl:text> -->
  7932. </script>
  7933. </xsl:template>
  7934. <!--
  7935. Translates occurrences of a string
  7936. in a piece of text with another string.
  7937. Param(s):
  7938. value (String) required
  7939. Text to translate
  7940. strToReplace (String) required
  7941. String to be replaced
  7942. replacementStr (String) required
  7943. Replacement text
  7944. -->
  7945. <xsl:template name="TranslateStr">
  7946. <xsl:param name="value"/>
  7947. <xsl:param name="strToReplace"/>
  7948. <xsl:param name="replacementStr"/>
  7949. <xsl:if test="$value != ''">
  7950. <xsl:variable name="beforeText" select="substring-before($value, $strToReplace)"/>
  7951. <xsl:choose>
  7952. <xsl:when test="$beforeText != ''">
  7953. <xsl:value-of select="$beforeText"/>
  7954. <xsl:value-of select="$replacementStr"/>
  7955. <xsl:call-template name="TranslateStr">
  7956. <xsl:with-param name="value" select="substring-after($value, $strToReplace)"/>
  7957. <xsl:with-param name="strToReplace" select="$strToReplace"/>
  7958. <xsl:with-param name="replacementStr" select="$replacementStr"/>
  7959. </xsl:call-template>
  7960. </xsl:when>
  7961. <xsl:otherwise>
  7962. <xsl:value-of select="$value"/>
  7963. </xsl:otherwise>
  7964. </xsl:choose>
  7965. </xsl:if>
  7966. </xsl:template>
  7967. <xsl:template name="HandleError">
  7968. <xsl:param name="errorMsg"/>
  7969. <xsl:param name="isTerminating">false</xsl:param>
  7970. <xsl:choose>
  7971. <xsl:when test="$isTerminating='true'">
  7972. <xsl:message terminate="yes">
  7973. <xsl:text>XS3P ERROR: </xsl:text>
  7974. <xsl:value-of select="$errorMsg"/>
  7975. </xsl:message>
  7976. </xsl:when>
  7977. <xsl:otherwise>
  7978. <span style="font-weight: bold; color: red">
  7979. <xsl:text>ERROR: </xsl:text>
  7980. <xsl:value-of select="$errorMsg"/>
  7981. </span>
  7982. </xsl:otherwise>
  7983. </xsl:choose>
  7984. </xsl:template>
  7985. </xsl:stylesheet>