1 16 19 package org.apache.xalan.processor; 20 21 import java.util.Hashtable ; 22 23 import org.apache.xalan.templates.Constants; 24 import org.apache.xalan.templates.ElemApplyImport; 25 import org.apache.xalan.templates.ElemApplyTemplates; 26 import org.apache.xalan.templates.ElemAttribute; 27 import org.apache.xalan.templates.ElemCallTemplate; 28 import org.apache.xalan.templates.ElemChoose; 29 import org.apache.xalan.templates.ElemComment; 30 import org.apache.xalan.templates.ElemCopy; 31 import org.apache.xalan.templates.ElemCopyOf; 32 import org.apache.xalan.templates.ElemElement; 33 import org.apache.xalan.templates.ElemExsltFuncResult; 34 import org.apache.xalan.templates.ElemExsltFunction; 35 import org.apache.xalan.templates.ElemExtensionDecl; 36 import org.apache.xalan.templates.ElemExtensionScript; 37 import org.apache.xalan.templates.ElemFallback; 38 import org.apache.xalan.templates.ElemForEach; 39 import org.apache.xalan.templates.ElemIf; 40 import org.apache.xalan.templates.ElemLiteralResult; 41 import org.apache.xalan.templates.ElemMessage; 42 import org.apache.xalan.templates.ElemNumber; 43 import org.apache.xalan.templates.ElemOtherwise; 44 import org.apache.xalan.templates.ElemPI; 45 import org.apache.xalan.templates.ElemParam; 46 import org.apache.xalan.templates.ElemSort; 47 import org.apache.xalan.templates.ElemTemplate; 48 import org.apache.xalan.templates.ElemText; 49 import org.apache.xalan.templates.ElemTextLiteral; 50 import org.apache.xalan.templates.ElemUnknown; 51 import org.apache.xalan.templates.ElemValueOf; 52 import org.apache.xalan.templates.ElemVariable; 53 import org.apache.xalan.templates.ElemWhen; 54 import org.apache.xalan.templates.ElemWithParam; 55 import org.apache.xml.utils.QName; 56 57 62 public class XSLTSchema extends XSLTElementDef 63 { 64 65 68 XSLTSchema() 69 { 70 build(); 71 } 72 73 77 void build() 78 { 79 XSLTAttributeDef hrefAttr = new XSLTAttributeDef(null, "href", 81 XSLTAttributeDef.T_URL, true, false,XSLTAttributeDef.ERROR); 82 83 XSLTAttributeDef elementsAttr = new XSLTAttributeDef(null, "elements", 85 XSLTAttributeDef.T_SIMPLEPATTERNLIST, 86 true, false, XSLTAttributeDef.ERROR); 87 88 91 XSLTAttributeDef methodAttr = new XSLTAttributeDef(null, "method", 93 XSLTAttributeDef.T_QNAME, false, false,XSLTAttributeDef.ERROR); 94 XSLTAttributeDef versionAttr = new XSLTAttributeDef(null, "version", 95 XSLTAttributeDef.T_NMTOKEN, false, false,XSLTAttributeDef.ERROR); 96 XSLTAttributeDef encodingAttr = new XSLTAttributeDef(null, "encoding", 97 XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.ERROR); 98 XSLTAttributeDef omitXmlDeclarationAttr = new XSLTAttributeDef(null, 99 "omit-xml-declaration", 100 XSLTAttributeDef.T_YESNO, 101 false, false,XSLTAttributeDef.ERROR); 102 XSLTAttributeDef standaloneAttr = new XSLTAttributeDef(null, 103 "standalone", 104 XSLTAttributeDef.T_YESNO, false, false,XSLTAttributeDef.ERROR); 105 XSLTAttributeDef doctypePublicAttr = new XSLTAttributeDef(null, 106 "doctype-public", 107 XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.ERROR); 108 XSLTAttributeDef doctypeSystemAttr = new XSLTAttributeDef(null, 109 "doctype-system", 110 XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.ERROR); 111 XSLTAttributeDef cdataSectionElementsAttr = new XSLTAttributeDef(null, 112 "cdata-section-elements", 113 XSLTAttributeDef.T_QNAMES_RESOLVE_NULL, 114 false, false,XSLTAttributeDef.ERROR); 115 XSLTAttributeDef indentAttr = new XSLTAttributeDef(null, "indent", 116 XSLTAttributeDef.T_YESNO, false, false,XSLTAttributeDef.ERROR); 117 XSLTAttributeDef mediaTypeAttr = new XSLTAttributeDef(null, "media-type", 118 XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.ERROR); 119 120 121 XSLTAttributeDef nameAttrRequired = new XSLTAttributeDef(null, "name", 125 XSLTAttributeDef.T_QNAME, true, false,XSLTAttributeDef.ERROR); 126 XSLTAttributeDef nameAVTRequired = new XSLTAttributeDef(null, "name", 130 XSLTAttributeDef.T_AVT_QNAME, true, true,XSLTAttributeDef.WARNING); 131 132 133 XSLTAttributeDef nameAVT_NCNAMERequired = new XSLTAttributeDef(null, "name", 137 XSLTAttributeDef.T_NCNAME, true, true,XSLTAttributeDef.WARNING); 138 139 XSLTAttributeDef nameAttrOpt_ERROR = new XSLTAttributeDef(null, "name", 143 XSLTAttributeDef.T_QNAME, false, false,XSLTAttributeDef.ERROR); 144 145 XSLTAttributeDef useAttr = new XSLTAttributeDef(null, "use", 147 XSLTAttributeDef.T_EXPR, true, false,XSLTAttributeDef.ERROR); 148 149 XSLTAttributeDef namespaceAVTOpt = new XSLTAttributeDef(null, 151 "namespace",XSLTAttributeDef.T_URL, 152 false, true,XSLTAttributeDef.WARNING); 153 XSLTAttributeDef decimalSeparatorAttr = new XSLTAttributeDef(null, 155 "decimal-separator", 156 XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR, "."); 157 XSLTAttributeDef infinityAttr = new XSLTAttributeDef(null, "infinity", 158 XSLTAttributeDef.T_CDATA, false,XSLTAttributeDef.ERROR,"Infinity"); 159 XSLTAttributeDef minusSignAttr = new XSLTAttributeDef(null, "minus-sign", 160 XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR,"-"); 161 XSLTAttributeDef NaNAttr = new XSLTAttributeDef(null, "NaN", 162 XSLTAttributeDef.T_CDATA, false,XSLTAttributeDef.ERROR, "NaN"); 163 XSLTAttributeDef percentAttr = new XSLTAttributeDef(null, "percent", 164 XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR, "%"); 165 XSLTAttributeDef perMilleAttr = new XSLTAttributeDef(null, "per-mille", 166 XSLTAttributeDef.T_CHAR, 167 false, false,XSLTAttributeDef.ERROR ); 168 XSLTAttributeDef zeroDigitAttr = new XSLTAttributeDef(null, "zero-digit", 169 XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR, "0"); 170 XSLTAttributeDef digitAttr = new XSLTAttributeDef(null, "digit", 171 XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR, "#"); 172 XSLTAttributeDef patternSeparatorAttr = new XSLTAttributeDef(null, 173 "pattern-separator", 174 XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR, ";"); 175 XSLTAttributeDef groupingSeparatorAttr = new XSLTAttributeDef(null, 177 "grouping-separator", 178 XSLTAttributeDef.T_CHAR, false,XSLTAttributeDef.ERROR,","); 179 180 181 XSLTAttributeDef useAttributeSetsAttr = new XSLTAttributeDef(null, 183 "use-attribute-sets", 184 XSLTAttributeDef.T_QNAMES, 185 false, false, XSLTAttributeDef.ERROR); 186 187 XSLTAttributeDef testAttrRequired = new XSLTAttributeDef(null, "test", 189 XSLTAttributeDef.T_EXPR, true, false,XSLTAttributeDef.ERROR); 190 191 192 XSLTAttributeDef selectAttrRequired = new XSLTAttributeDef(null, 195 "select", 196 XSLTAttributeDef.T_EXPR, true, false,XSLTAttributeDef.ERROR); 197 198 XSLTAttributeDef selectAttrOpt = new XSLTAttributeDef(null, "select", 201 XSLTAttributeDef.T_EXPR, false, false,XSLTAttributeDef.ERROR); 202 203 XSLTAttributeDef selectAttrDefNode = new XSLTAttributeDef(null, "select", 207 XSLTAttributeDef.T_EXPR, false,XSLTAttributeDef.ERROR, "node()"); 208 XSLTAttributeDef selectAttrDefDot = new XSLTAttributeDef(null, "select", 212 XSLTAttributeDef.T_EXPR, false,XSLTAttributeDef.ERROR, "."); 213 XSLTAttributeDef matchAttrRequired = new XSLTAttributeDef(null, "match", 215 XSLTAttributeDef.T_PATTERN, true, false,XSLTAttributeDef.ERROR); 216 XSLTAttributeDef matchAttrOpt = new XSLTAttributeDef(null, "match", 218 XSLTAttributeDef.T_PATTERN, false, false,XSLTAttributeDef.ERROR); 219 XSLTAttributeDef priorityAttr = new XSLTAttributeDef(null, "priority", 221 XSLTAttributeDef.T_NUMBER, false, false,XSLTAttributeDef.ERROR); 222 223 XSLTAttributeDef modeAttr = new XSLTAttributeDef(null, "mode", 225 XSLTAttributeDef.T_QNAME, false, false,XSLTAttributeDef.ERROR); 226 227 XSLTAttributeDef spaceAttr = 228 new XSLTAttributeDef(Constants.S_XMLNAMESPACEURI, "space", false, false, false, XSLTAttributeDef.WARNING, 229 "default", Constants.ATTRVAL_STRIP, "preserve", 230 Constants.ATTRVAL_PRESERVE); 231 232 233 XSLTAttributeDef spaceAttrLiteral = 234 new XSLTAttributeDef(Constants.S_XMLNAMESPACEURI, "space", 235 XSLTAttributeDef.T_URL, false, true,XSLTAttributeDef.ERROR); 236 XSLTAttributeDef stylesheetPrefixAttr = new XSLTAttributeDef(null, 238 "stylesheet-prefix", 239 XSLTAttributeDef.T_CDATA, true, false,XSLTAttributeDef.ERROR); 240 XSLTAttributeDef resultPrefixAttr = new XSLTAttributeDef(null, 241 "result-prefix", 242 XSLTAttributeDef.T_CDATA, true, false,XSLTAttributeDef.ERROR); 243 244 XSLTAttributeDef disableOutputEscapingAttr = new XSLTAttributeDef(null, 246 "disable-output-escaping", 247 XSLTAttributeDef.T_YESNO, 248 false, false,XSLTAttributeDef.ERROR); 249 250 XSLTAttributeDef levelAttr = new XSLTAttributeDef(null, "level", false, false, false, XSLTAttributeDef.ERROR, 252 "single", Constants.NUMBERLEVEL_SINGLE, 253 "multiple", Constants.NUMBERLEVEL_MULTI, 254 "any", Constants.NUMBERLEVEL_ANY); 255 levelAttr.setDefault("single"); 256 XSLTAttributeDef countAttr = new XSLTAttributeDef(null, "count", 257 XSLTAttributeDef.T_PATTERN, false, false,XSLTAttributeDef.ERROR); 258 XSLTAttributeDef fromAttr = new XSLTAttributeDef(null, "from", 259 XSLTAttributeDef.T_PATTERN, false, false,XSLTAttributeDef.ERROR); 260 XSLTAttributeDef valueAttr = new XSLTAttributeDef(null, "value", 261 XSLTAttributeDef.T_EXPR, false, false,XSLTAttributeDef.ERROR); 262 XSLTAttributeDef formatAttr = new XSLTAttributeDef(null, "format", 263 XSLTAttributeDef.T_CDATA, false, true,XSLTAttributeDef.ERROR); 264 formatAttr.setDefault("1"); 265 266 XSLTAttributeDef langAttr = new XSLTAttributeDef(null, "lang", 268 XSLTAttributeDef.T_NMTOKEN, false, true,XSLTAttributeDef.ERROR); 269 270 XSLTAttributeDef letterValueAttr = new XSLTAttributeDef(null, 272 "letter-value", 273 false, true, false, XSLTAttributeDef.ERROR, 274 "alphabetic", Constants.NUMBERLETTER_ALPHABETIC, 275 "traditional", Constants.NUMBERLETTER_TRADITIONAL); 276 XSLTAttributeDef groupingSeparatorAVT = new XSLTAttributeDef(null, 278 "grouping-separator", 279 XSLTAttributeDef.T_CHAR, false, true,XSLTAttributeDef.ERROR); 280 XSLTAttributeDef groupingSizeAttr = new XSLTAttributeDef(null, 282 "grouping-size", 283 XSLTAttributeDef.T_NUMBER, false, true,XSLTAttributeDef.ERROR); 284 285 XSLTAttributeDef dataTypeAttr = new XSLTAttributeDef(null, "data-type", false, true, true, XSLTAttributeDef.ERROR, 287 "text", Constants.SORTDATATYPE_TEXT ,"number", Constants.SORTDATATYPE_TEXT); 288 dataTypeAttr.setDefault("text"); 289 290 XSLTAttributeDef orderAttr = new XSLTAttributeDef(null, "order", false, true, false,XSLTAttributeDef.ERROR, 292 "ascending", Constants.SORTORDER_ASCENDING, 293 "descending", Constants.SORTORDER_DESCENDING); 294 orderAttr.setDefault("ascending"); 295 296 XSLTAttributeDef caseOrderAttr = new XSLTAttributeDef(null, "case-order", false, true, false,XSLTAttributeDef.ERROR, 298 "upper-first", Constants.SORTCASEORDER_UPPERFIRST , 299 "lower-first", Constants.SORTCASEORDER_LOWERFIRST); 300 301 XSLTAttributeDef terminateAttr = new XSLTAttributeDef(null, "terminate", 303 XSLTAttributeDef.T_YESNO, false, false,XSLTAttributeDef.ERROR); 304 terminateAttr.setDefault("no"); 305 306 XSLTAttributeDef xslExcludeResultPrefixesAttr = 308 new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, 309 "exclude-result-prefixes", 310 XSLTAttributeDef.T_PREFIXLIST, false, false,XSLTAttributeDef.ERROR); 311 XSLTAttributeDef xslExtensionElementPrefixesAttr = 312 new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, 313 "extension-element-prefixes", 314 XSLTAttributeDef.T_PREFIX_URLLIST, false, false,XSLTAttributeDef.ERROR); 315 XSLTAttributeDef xslUseAttributeSetsAttr = 317 new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "use-attribute-sets", 318 XSLTAttributeDef.T_QNAMES, false, false,XSLTAttributeDef.ERROR); 319 XSLTAttributeDef xslVersionAttr = 320 new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "version", 321 XSLTAttributeDef.T_NMTOKEN, false, false,XSLTAttributeDef.ERROR); 322 323 XSLTElementDef charData = new XSLTElementDef(this, null, "text()", 324 null , null , null, 325 new ProcessorCharacters(), 326 ElemTextLiteral.class ); 327 328 charData.setType(XSLTElementDef.T_PCDATA); 329 330 XSLTElementDef whiteSpaceOnly = new XSLTElementDef(this, null, "text()", 331 null , null , 332 null, 333 null, 334 ElemTextLiteral.class ); 335 336 charData.setType(XSLTElementDef.T_PCDATA); 337 338 XSLTAttributeDef resultAttr = new XSLTAttributeDef(null, "*", 339 XSLTAttributeDef.T_AVT, false, true,XSLTAttributeDef.WARNING); 340 XSLTAttributeDef xslResultAttr = 341 new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "*", 342 XSLTAttributeDef.T_CDATA, false, false,XSLTAttributeDef.WARNING); 343 344 XSLTElementDef[] templateElements = new XSLTElementDef[23]; 345 XSLTElementDef[] templateElementsAndParams = new XSLTElementDef[24]; 346 XSLTElementDef[] templateElementsAndSort = new XSLTElementDef[24]; 347 XSLTElementDef[] exsltFunctionElements = new XSLTElementDef[24]; 349 350 XSLTElementDef[] charTemplateElements = new XSLTElementDef[15]; 351 XSLTElementDef resultElement = new XSLTElementDef(this, null, "*", 352 null , 353 templateElements , 354 new XSLTAttributeDef[]{ 355 spaceAttrLiteral, xslExcludeResultPrefixesAttr, 357 xslExtensionElementPrefixesAttr, 358 xslUseAttributeSetsAttr, 359 xslVersionAttr, 360 xslResultAttr, 361 resultAttr }, 362 new ProcessorLRE(), 363 ElemLiteralResult.class , 20, true); 364 XSLTElementDef unknownElement = 365 new XSLTElementDef(this, "*", "unknown", null , 366 templateElementsAndParams , 367 new XSLTAttributeDef[]{ xslExcludeResultPrefixesAttr, 368 xslExtensionElementPrefixesAttr, 369 xslUseAttributeSetsAttr, 370 xslVersionAttr, 371 xslResultAttr, 372 resultAttr }, 373 new ProcessorUnknown(), 374 ElemUnknown.class , 20, true); 375 XSLTElementDef xslValueOf = new XSLTElementDef(this, 376 Constants.S_XSLNAMESPACEURL, "value-of", 377 null , null , 378 new XSLTAttributeDef[]{ selectAttrRequired, 379 disableOutputEscapingAttr }, 380 new ProcessorTemplateElem(), 381 ElemValueOf.class , 20, true); 382 XSLTElementDef xslCopyOf = new XSLTElementDef(this, 383 Constants.S_XSLNAMESPACEURL, "copy-of", 384 null , null , 385 new XSLTAttributeDef[]{ selectAttrRequired }, 386 new ProcessorTemplateElem(), 387 ElemCopyOf.class , 20, true); 388 XSLTElementDef xslNumber = new XSLTElementDef(this, 389 Constants.S_XSLNAMESPACEURL, "number", 390 null , null , 391 new XSLTAttributeDef[]{ levelAttr, 392 countAttr, 393 fromAttr, 394 valueAttr, 395 formatAttr, 396 langAttr, 397 letterValueAttr, 398 groupingSeparatorAVT, 399 groupingSizeAttr }, 400 new ProcessorTemplateElem(), 401 ElemNumber.class , 20, true); 402 403 XSLTElementDef xslSort = new XSLTElementDef(this, 406 Constants.S_XSLNAMESPACEURL, 407 "sort", null , 408 null , 409 new XSLTAttributeDef[]{ 410 selectAttrDefDot, 411 langAttr, 412 dataTypeAttr, 413 orderAttr, 414 caseOrderAttr }, 415 new ProcessorTemplateElem(), 416 ElemSort.class, 19, true ); 417 XSLTElementDef xslWithParam = new XSLTElementDef(this, 418 Constants.S_XSLNAMESPACEURL, 419 "with-param", null , 420 templateElements , new XSLTAttributeDef[]{ nameAttrRequired, 422 selectAttrOpt }, new ProcessorTemplateElem(), 423 ElemWithParam.class , 19, true); 424 XSLTElementDef xslApplyTemplates = new XSLTElementDef(this, 425 Constants.S_XSLNAMESPACEURL, 426 "apply-templates", null , 427 new XSLTElementDef[]{ xslSort, 428 xslWithParam } , new XSLTAttributeDef[]{ 429 selectAttrDefNode, 430 modeAttr }, 431 new ProcessorTemplateElem(), 432 ElemApplyTemplates.class , 20, true); 433 XSLTElementDef xslApplyImports = 434 new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "apply-imports", 435 null , null , 436 new XSLTAttributeDef[]{}, 437 new ProcessorTemplateElem(), 438 ElemApplyImport.class ); 439 XSLTElementDef xslForEach = new XSLTElementDef(this, 440 Constants.S_XSLNAMESPACEURL, "for-each", 441 null , templateElementsAndSort, new XSLTAttributeDef[]{ selectAttrRequired, 443 spaceAttr }, 444 new ProcessorTemplateElem(), 445 ElemForEach.class , true, false, true, 20, true); 446 XSLTElementDef xslIf = new XSLTElementDef(this, 447 Constants.S_XSLNAMESPACEURL, 448 "if", null , 449 templateElements , new XSLTAttributeDef[]{ 451 testAttrRequired, 452 spaceAttr }, new ProcessorTemplateElem(), 453 ElemIf.class , 20, true); 454 XSLTElementDef xslWhen = 455 new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "when", 456 null , templateElements , new XSLTAttributeDef[]{ 458 testAttrRequired, 459 spaceAttr }, new ProcessorTemplateElem(), 460 ElemWhen.class , 461 false, true, 1, true); 462 XSLTElementDef xslOtherwise = new XSLTElementDef(this, 463 Constants.S_XSLNAMESPACEURL, "otherwise", 464 null , 465 templateElements , new XSLTAttributeDef[]{ spaceAttr }, 467 new ProcessorTemplateElem(), 468 ElemOtherwise.class , 469 false, false, 2, false); 470 XSLTElementDef xslChoose = new XSLTElementDef(this, 471 Constants.S_XSLNAMESPACEURL, "choose", 472 null , 473 new XSLTElementDef[]{ xslWhen, 474 xslOtherwise } , 475 new XSLTAttributeDef[]{ spaceAttr }, 476 new ProcessorTemplateElem(), 477 ElemChoose.class , true, false, true, 20, true); 478 XSLTElementDef xslAttribute = new XSLTElementDef(this, 479 Constants.S_XSLNAMESPACEURL, "attribute", 480 null , 481 charTemplateElements , new XSLTAttributeDef[]{ nameAVTRequired, 483 namespaceAVTOpt, 484 spaceAttr }, 485 new ProcessorTemplateElem(), 486 ElemAttribute.class , 20, true); 487 XSLTElementDef xslCallTemplate = 488 new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "call-template", 489 null , 490 new XSLTElementDef[]{ xslWithParam } , 491 new XSLTAttributeDef[]{ nameAttrRequired }, 492 new ProcessorTemplateElem(), 493 ElemCallTemplate.class , 20, true); 494 XSLTElementDef xslVariable = new XSLTElementDef(this, 495 Constants.S_XSLNAMESPACEURL, "variable", 496 null , 497 templateElements , new XSLTAttributeDef[]{ nameAttrRequired, 499 selectAttrOpt }, 500 new ProcessorTemplateElem(), 501 ElemVariable.class , 20, true); 502 XSLTElementDef xslParam = new XSLTElementDef(this, 503 Constants.S_XSLNAMESPACEURL, "param", 504 null , 505 templateElements , new XSLTAttributeDef[]{ nameAttrRequired, 507 selectAttrOpt }, 508 new ProcessorTemplateElem(), 509 ElemParam.class , 19, true); 510 XSLTElementDef xslText = 511 new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "text", 512 null , 513 new XSLTElementDef[]{ charData } , 514 new XSLTAttributeDef[]{ disableOutputEscapingAttr }, 515 new ProcessorText(), 516 ElemText.class , 20, true); 517 XSLTElementDef xslProcessingInstruction = 518 new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, 519 "processing-instruction", null , 520 charTemplateElements , new XSLTAttributeDef[]{ 522 nameAVT_NCNAMERequired, 523 spaceAttr }, 524 new ProcessorTemplateElem(), 525 ElemPI.class , 20, true); 526 XSLTElementDef xslElement = new XSLTElementDef(this, 527 Constants.S_XSLNAMESPACEURL, "element", 528 null , 529 templateElements , new XSLTAttributeDef[]{ nameAVTRequired, 531 namespaceAVTOpt, 532 useAttributeSetsAttr, 533 spaceAttr }, 534 new ProcessorTemplateElem(), 535 ElemElement.class , 20, true); 536 XSLTElementDef xslComment = new XSLTElementDef(this, 537 Constants.S_XSLNAMESPACEURL, "comment", 538 null , 539 charTemplateElements , new XSLTAttributeDef[]{ spaceAttr }, 541 new ProcessorTemplateElem(), 542 ElemComment.class , 20, true); 543 XSLTElementDef xslCopy = 544 new XSLTElementDef(this, Constants.S_XSLNAMESPACEURL, "copy", 545 null , templateElements , new XSLTAttributeDef[]{ 547 spaceAttr, 548 useAttributeSetsAttr }, 549 new ProcessorTemplateElem(), 550 ElemCopy.class , 20, true); 551 XSLTElementDef xslMessage = new XSLTElementDef(this, 552 Constants.S_XSLNAMESPACEURL, "message", 553 null , 554 templateElements , new XSLTAttributeDef[]{ terminateAttr }, 556 new ProcessorTemplateElem(), 557 ElemMessage.class , 20, true); 558 XSLTElementDef xslFallback = new XSLTElementDef(this, 559 Constants.S_XSLNAMESPACEURL, "fallback", 560 null , 561 templateElements , new XSLTAttributeDef[]{ spaceAttr }, 563 new ProcessorTemplateElem(), 564 ElemFallback.class , 20, true); 565 XSLTElementDef exsltFunction = 567 new XSLTElementDef(this, 568 Constants.S_EXSLT_FUNCTIONS_URL, 569 "function", 570 null , 571 exsltFunctionElements , 572 new XSLTAttributeDef[]{ nameAttrRequired }, 573 new ProcessorExsltFunction(), 574 ElemExsltFunction.class ); 575 XSLTElementDef exsltResult = 576 new XSLTElementDef(this, 577 Constants.S_EXSLT_FUNCTIONS_URL, 578 "result", 579 null , 580 templateElements , 581 new XSLTAttributeDef[]{ selectAttrOpt }, 582 new ProcessorExsltFuncResult(), 583 ElemExsltFuncResult.class ); 584 585 586 int i = 0; 587 588 templateElements[i++] = charData; 590 templateElements[i++] = xslApplyTemplates; 592 templateElements[i++] = xslCallTemplate; 593 templateElements[i++] = xslApplyImports; 594 templateElements[i++] = xslForEach; 595 templateElements[i++] = xslValueOf; 596 templateElements[i++] = xslCopyOf; 597 templateElements[i++] = xslNumber; 598 templateElements[i++] = xslChoose; 599 templateElements[i++] = xslIf; 600 templateElements[i++] = xslText; 601 templateElements[i++] = xslCopy; 602 templateElements[i++] = xslVariable; 603 templateElements[i++] = xslMessage; 604 templateElements[i++] = xslFallback; 605 606 templateElements[i++] = xslProcessingInstruction; 608 templateElements[i++] = xslComment; 609 templateElements[i++] = xslElement; 610 templateElements[i++] = xslAttribute; 611 templateElements[i++] = resultElement; 612 templateElements[i++] = unknownElement; 613 templateElements[i++] = exsltFunction; 614 templateElements[i++] = exsltResult; 615 616 int k; 617 618 for (k = 0; k < i; k++) 619 { 620 templateElementsAndParams[k] = templateElements[k]; 621 templateElementsAndSort[k] = templateElements[k]; 622 exsltFunctionElements[k] = templateElements[k]; 623 624 } 625 626 templateElementsAndParams[k] = xslParam; 627 templateElementsAndSort[k] = xslSort; 628 exsltFunctionElements[k] = xslParam; 629 630 i = 0; 631 charTemplateElements[i++] = charData; 633 charTemplateElements[i++] = xslApplyTemplates; 635 charTemplateElements[i++] = xslCallTemplate; 636 charTemplateElements[i++] = xslApplyImports; 637 charTemplateElements[i++] = xslForEach; 638 charTemplateElements[i++] = xslValueOf; 639 charTemplateElements[i++] = xslCopyOf; 640 charTemplateElements[i++] = xslNumber; 641 charTemplateElements[i++] = xslChoose; 642 charTemplateElements[i++] = xslIf; 643 charTemplateElements[i++] = xslText; 644 charTemplateElements[i++] = xslCopy; 645 charTemplateElements[i++] = xslVariable; 646 charTemplateElements[i++] = xslMessage; 647 charTemplateElements[i++] = xslFallback; 648 649 XSLTElementDef importDef = new XSLTElementDef(this, 650 Constants.S_XSLNAMESPACEURL, "import", 651 null , null , 652 new XSLTAttributeDef[]{ hrefAttr }, new ProcessorImport(), 654 null , 655 1, true); 656 XSLTElementDef includeDef = new XSLTElementDef(this, 657 Constants.S_XSLNAMESPACEURL, "include", 658 null , null , new XSLTAttributeDef[]{ hrefAttr }, 660 new ProcessorInclude(), 661 null , 662 20, true); 663 664 XSLTAttributeDef[] scriptAttrs = new XSLTAttributeDef[]{ 665 new XSLTAttributeDef(null, "lang", XSLTAttributeDef.T_NMTOKEN, 666 true, false,XSLTAttributeDef.WARNING), 667 new XSLTAttributeDef(null, "src", XSLTAttributeDef.T_URL, 668 false, false,XSLTAttributeDef.WARNING)}; 669 670 XSLTAttributeDef[] componentAttrs = new XSLTAttributeDef[]{ 671 new XSLTAttributeDef(null, "prefix", XSLTAttributeDef.T_NMTOKEN, 672 true, false,XSLTAttributeDef.WARNING), 673 new XSLTAttributeDef(null, "elements", XSLTAttributeDef.T_STRINGLIST, 674 false, false,XSLTAttributeDef.WARNING), 675 new XSLTAttributeDef(null, "functions", XSLTAttributeDef.T_STRINGLIST, 676 false, false,XSLTAttributeDef.WARNING) }; 677 678 XSLTElementDef[] topLevelElements = new XSLTElementDef[] 679 {includeDef, 680 importDef, 681 whiteSpaceOnly, 683 unknownElement, 684 new XSLTElementDef( 685 this, 686 Constants.S_XSLNAMESPACEURL, 687 "strip-space", 688 null , 689 null , 690 new XSLTAttributeDef[]{ 691 elementsAttr }, 692 new ProcessorStripSpace(), 693 null , 20, true), 694 new XSLTElementDef( 695 this, 696 Constants.S_XSLNAMESPACEURL, 697 "preserve-space", 698 null , 699 null , 700 new XSLTAttributeDef[]{ 701 elementsAttr }, 702 new ProcessorPreserveSpace(), 703 null , 20, true), 704 new XSLTElementDef( 705 this, 706 Constants.S_XSLNAMESPACEURL, 707 "output", 708 null , 709 null , 710 new XSLTAttributeDef[]{ 711 methodAttr, 712 versionAttr, 713 encodingAttr, 714 omitXmlDeclarationAttr, 715 standaloneAttr, 716 doctypePublicAttr, 717 doctypeSystemAttr, 718 cdataSectionElementsAttr, 719 indentAttr, 720 mediaTypeAttr, 721 XSLTAttributeDef.m_foreignAttr }, 722 new ProcessorOutputElem(), null , 20, true), 723 new XSLTElementDef( 724 this, 725 Constants.S_XSLNAMESPACEURL, 726 "key", 727 null , 728 null , new XSLTAttributeDef[]{ nameAttrRequired, 730 matchAttrRequired, 731 useAttr }, 732 new ProcessorKey(), null , 20, true), 733 new XSLTElementDef( 734 this, 735 Constants.S_XSLNAMESPACEURL, 736 "decimal-format", 737 null , 738 null , new XSLTAttributeDef[]{ 740 nameAttrOpt_ERROR, 741 decimalSeparatorAttr, 742 groupingSeparatorAttr, 743 infinityAttr, 744 minusSignAttr, 745 NaNAttr, 746 percentAttr, 747 perMilleAttr, 748 zeroDigitAttr, 749 digitAttr, 750 patternSeparatorAttr }, 751 new ProcessorDecimalFormat(), 752 null , 20, true), 753 new XSLTElementDef( 754 this, 755 Constants.S_XSLNAMESPACEURL, 756 "attribute-set", 757 null , 758 new XSLTElementDef[]{ 759 xslAttribute } , 760 new XSLTAttributeDef[]{ 761 nameAttrRequired, 762 useAttributeSetsAttr }, 763 new ProcessorAttributeSet(), 764 null , 20, true), 765 new XSLTElementDef( 766 this, 767 Constants.S_XSLNAMESPACEURL, 768 "variable", 769 null , 770 templateElements , 771 new XSLTAttributeDef[]{ 772 nameAttrRequired, 773 selectAttrOpt }, 774 new ProcessorGlobalVariableDecl(), 775 ElemVariable.class , 20, true), 776 new XSLTElementDef( 777 this, 778 Constants.S_XSLNAMESPACEURL, 779 "param", 780 null , 781 templateElements , 782 new XSLTAttributeDef[]{ 783 nameAttrRequired, 784 selectAttrOpt }, 785 new ProcessorGlobalParamDecl(), 786 ElemParam.class , 20, true), 787 new XSLTElementDef( 788 this, 789 Constants.S_XSLNAMESPACEURL, 790 "template", 791 null , 792 templateElementsAndParams , 793 new XSLTAttributeDef[]{ 794 matchAttrOpt, 795 nameAttrOpt_ERROR, 796 priorityAttr, 797 modeAttr, 798 spaceAttr }, 799 new ProcessorTemplate(), ElemTemplate.class , true, 20, true), 800 new XSLTElementDef( 801 this, 802 Constants.S_XSLNAMESPACEURL, 803 "namespace-alias", 804 null , 805 null , new XSLTAttributeDef[]{ 807 stylesheetPrefixAttr, 808 resultPrefixAttr }, 809 new ProcessorNamespaceAlias(), null , 20, true), 810 new XSLTElementDef( 811 this, 812 Constants.S_BUILTIN_EXTENSIONS_URL, 813 "component", 814 null , 815 new XSLTElementDef[]{ 816 new XSLTElementDef( 817 this, 818 Constants.S_BUILTIN_EXTENSIONS_URL, 819 "script", 820 null , 821 new XSLTElementDef[]{ 822 charData } , 823 scriptAttrs, 824 new ProcessorLRE(), 825 ElemExtensionScript.class , 20, true) }, componentAttrs, 827 new ProcessorLRE(), ElemExtensionDecl.class ), 828 new XSLTElementDef( 829 this, 830 Constants.S_BUILTIN_OLD_EXTENSIONS_URL, 831 "component", 832 null , 833 new XSLTElementDef[]{ 834 new XSLTElementDef( 835 this, 836 Constants.S_BUILTIN_OLD_EXTENSIONS_URL, 837 "script", 838 null , 839 new XSLTElementDef[]{ 840 charData } , 841 scriptAttrs, 842 new ProcessorLRE(), 843 ElemExtensionScript.class , 20, true) }, componentAttrs, 845 new ProcessorLRE(), ElemExtensionDecl.class ), 846 exsltFunction}; 848 XSLTAttributeDef excludeResultPrefixesAttr = 849 new XSLTAttributeDef(null, "exclude-result-prefixes", 850 XSLTAttributeDef.T_PREFIXLIST, false,false,XSLTAttributeDef.WARNING); 851 XSLTAttributeDef extensionElementPrefixesAttr = 852 new XSLTAttributeDef(null, "extension-element-prefixes", 853 XSLTAttributeDef.T_PREFIX_URLLIST, false,false,XSLTAttributeDef.WARNING); 854 XSLTAttributeDef idAttr = new XSLTAttributeDef(null, "id", 855 XSLTAttributeDef.T_CDATA, false,false,XSLTAttributeDef.WARNING); 856 XSLTAttributeDef versionAttrRequired = new XSLTAttributeDef(null, 857 "version", 858 XSLTAttributeDef.T_NMTOKEN, 859 true,false,XSLTAttributeDef.WARNING); 860 XSLTElementDef stylesheetElemDef = new XSLTElementDef(this, 861 Constants.S_XSLNAMESPACEURL, 862 "stylesheet", "transform", 863 topLevelElements, 864 new XSLTAttributeDef[]{ 865 extensionElementPrefixesAttr, 866 excludeResultPrefixesAttr, 867 idAttr, 868 versionAttrRequired, 869 spaceAttr }, new ProcessorStylesheetElement(), 870 null , 871 true, -1, false); 872 873 importDef.setElements(new XSLTElementDef[]{ stylesheetElemDef, 874 resultElement, 875 unknownElement }); 876 includeDef.setElements(new XSLTElementDef[]{ stylesheetElemDef, 877 resultElement, 878 unknownElement }); 879 build(null, null, null, new XSLTElementDef[]{ stylesheetElemDef, 880 whiteSpaceOnly, 881 resultElement, 882 unknownElement }, null, 883 new ProcessorStylesheetDoc(), 884 null 885 ); 886 } 887 888 893 private Hashtable m_availElems = new Hashtable (); 894 895 901 public Hashtable getElemsAvailable() 902 { 903 return m_availElems; 904 } 905 906 910 void addAvailableElement(QName elemName) 911 { 912 m_availElems.put(elemName, elemName); 913 } 914 915 921 public boolean elementAvailable(QName elemName) 922 { 923 return m_availElems.containsKey(elemName); 924 } 925 } 926 927 | Popular Tags |