1 16 19 package org.apache.xalan.processor; 20 21 import java.util.Stack ; 22 23 import javax.xml.transform.ErrorListener ; 24 import javax.xml.transform.SourceLocator ; 25 import javax.xml.transform.Templates ; 26 import javax.xml.transform.TransformerConfigurationException ; 27 import javax.xml.transform.TransformerException ; 28 import javax.xml.transform.sax.TemplatesHandler ; 29 30 import org.apache.xalan.extensions.ExpressionVisitor; 31 import org.apache.xalan.res.XSLMessages; 32 import org.apache.xalan.res.XSLTErrorResources; 33 import org.apache.xalan.templates.Constants; 34 import org.apache.xalan.templates.ElemForEach; 35 import org.apache.xalan.templates.ElemTemplateElement; 36 import org.apache.xalan.templates.Stylesheet; 37 import org.apache.xalan.templates.StylesheetRoot; 38 import org.apache.xml.utils.BoolStack; 39 import org.apache.xml.utils.NamespaceSupport2; 40 import org.apache.xml.utils.NodeConsumer; 41 import org.apache.xml.utils.PrefixResolver; 42 import org.apache.xml.utils.SAXSourceLocator; 43 import org.apache.xml.utils.XMLCharacterRecognizer; 44 import org.apache.xpath.XPath; 45 import org.apache.xpath.compiler.FunctionTable; 46 import org.apache.xpath.functions.Function; 47 48 import org.w3c.dom.Node ; 49 50 import org.xml.sax.Attributes ; 51 import org.xml.sax.InputSource ; 52 import org.xml.sax.Locator ; 53 import org.xml.sax.helpers.DefaultHandler ; 54 import org.xml.sax.helpers.NamespaceSupport ; 55 56 63 public class StylesheetHandler extends DefaultHandler 64 implements TemplatesHandler , PrefixResolver, NodeConsumer 65 { 66 67 68 static { 69 Function func = new org.apache.xalan.templates.FuncDocument(); 70 71 FunctionTable.installFunction("document", func); 72 73 func = new org.apache.xalan.templates.FuncFormatNumb(); 76 77 FunctionTable.installFunction("format-number", func); 78 79 } 80 89 public StylesheetHandler(TransformerFactoryImpl processor) 90 throws TransformerConfigurationException 91 { 92 93 init(processor); 95 } 96 97 102 void init(TransformerFactoryImpl processor) 103 { 104 m_stylesheetProcessor = processor; 105 106 m_processors.push(m_schema.getElementProcessor()); 108 this.pushNewNamespaceSupport(); 109 110 } 113 114 125 public XPath createXPath(String str, ElemTemplateElement owningTemplate) 126 throws javax.xml.transform.TransformerException 127 { 128 ErrorListener handler = m_stylesheetProcessor.getErrorListener(); 129 XPath xpath = new XPath(str, owningTemplate, this, XPath.SELECT, handler); 130 xpath.callVisitors(xpath, new ExpressionVisitor(getStylesheetRoot())); 132 return xpath; 133 } 134 135 145 XPath createMatchPatternXPath(String str, ElemTemplateElement owningTemplate) 146 throws javax.xml.transform.TransformerException 147 { 148 ErrorListener handler = m_stylesheetProcessor.getErrorListener(); 149 XPath xpath = new XPath(str, owningTemplate, this, XPath.MATCH, handler); 150 xpath.callVisitors(xpath, new ExpressionVisitor(getStylesheetRoot())); 152 return xpath; 153 } 154 155 164 public String getNamespaceForPrefix(String prefix) 165 { 166 return this.getNamespaceSupport().getURI(prefix); 167 } 168 169 180 public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context) 181 { 182 183 assertion(true, "can't process a context node in StylesheetHandler!"); 186 187 return null; 188 } 189 190 198 private boolean stackContains(Stack stack, String url) 199 { 200 201 int n = stack.size(); 202 boolean contains = false; 203 204 for (int i = 0; i < n; i++) 205 { 206 String url2 = (String ) stack.elementAt(i); 207 208 if (url2.equals(url)) 209 { 210 contains = true; 211 212 break; 213 } 214 } 215 216 return contains; 217 } 218 219 223 235 public Templates getTemplates() 236 { 237 return getStylesheetRoot(); 238 } 239 240 247 public void setSystemId(String baseID) 248 { 249 pushBaseIndentifier(baseID); 250 } 251 252 258 public String getSystemId() 259 { 260 return this.getBaseIdentifier(); 261 } 262 263 267 279 public InputSource resolveEntity(String publicId, String systemId) 280 throws org.xml.sax.SAXException 281 { 282 return getCurrentProcessor().resolveEntity(this, publicId, systemId); 283 } 284 285 289 302 public void notationDecl(String name, String publicId, String systemId) 303 { 304 getCurrentProcessor().notationDecl(this, name, publicId, systemId); 305 } 306 307 317 public void unparsedEntityDecl(String name, String publicId, 318 String systemId, String notationName) 319 { 320 getCurrentProcessor().unparsedEntityDecl(this, name, publicId, systemId, 321 notationName); 322 } 323 324 337 XSLTElementProcessor getProcessorFor( 338 String uri, String localName, String rawName) 339 throws org.xml.sax.SAXException 340 { 341 342 XSLTElementProcessor currentProcessor = getCurrentProcessor(); 343 XSLTElementDef def = currentProcessor.getElemDef(); 344 XSLTElementProcessor elemProcessor = def.getProcessorFor(uri, localName); 345 346 if (null == elemProcessor 347 && !(currentProcessor instanceof ProcessorStylesheetDoc) 348 && ((null == getStylesheet() 349 || Double.valueOf(getStylesheet().getVersion()).doubleValue() 350 > Constants.XSLTVERSUPPORTED) 351 ||(!uri.equals(Constants.S_XSLNAMESPACEURL) && 352 currentProcessor instanceof ProcessorStylesheetElement) 353 || getElemVersion() > Constants.XSLTVERSUPPORTED 354 )) 355 { 356 elemProcessor = def.getProcessorForUnknown(uri, localName); 357 } 358 359 if (null == elemProcessor) 360 error(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_ALLOWED_IN_POSITION, new Object []{rawName}),null); 362 363 return elemProcessor; 364 } 365 366 370 381 public void setDocumentLocator(Locator locator) 382 { 383 384 m_stylesheetLocatorStack.push(new SAXSourceLocator(locator)); 386 } 387 388 391 private int m_stylesheetLevel = -1; 392 393 401 public void startDocument() throws org.xml.sax.SAXException 402 { 403 m_stylesheetLevel++; 404 pushSpaceHandling(false); 405 } 406 407 411 private boolean m_parsingComplete = false; 412 413 422 public boolean isStylesheetParsingComplete() 423 { 424 return m_parsingComplete; 425 } 426 427 435 public void endDocument() throws org.xml.sax.SAXException 436 { 437 438 try 439 { 440 if (null != getStylesheetRoot()) 441 { 442 if (0 == m_stylesheetLevel) 443 getStylesheetRoot().recompose(); 444 } 445 else 446 throw new TransformerException (XSLMessages.createMessage(XSLTErrorResources.ER_NO_STYLESHEETROOT, null)); 448 XSLTElementProcessor elemProcessor = getCurrentProcessor(); 449 450 if (null != elemProcessor) 451 elemProcessor.startNonText(this); 452 453 m_stylesheetLevel--; 454 455 popSpaceHandling(); 456 457 m_parsingComplete = (m_stylesheetLevel < 0); 463 } 464 catch (TransformerException te) 465 { 466 throw new org.xml.sax.SAXException (te); 467 } 468 } 469 470 private java.util.Vector m_prefixMappings = new java.util.Vector (); 471 472 487 public void startPrefixMapping(String prefix, String uri) 488 throws org.xml.sax.SAXException 489 { 490 491 m_prefixMappings.addElement(prefix); m_prefixMappings.addElement(uri); } 498 499 513 public void endPrefixMapping(String prefix) throws org.xml.sax.SAXException 514 { 515 516 } 518 519 524 private void flushCharacters() throws org.xml.sax.SAXException 525 { 526 527 XSLTElementProcessor elemProcessor = getCurrentProcessor(); 528 529 if (null != elemProcessor) 530 elemProcessor.startNonText(this); 531 } 532 533 545 public void startElement( 546 String uri, String localName, String rawName, Attributes attributes) 547 throws org.xml.sax.SAXException 548 { 549 NamespaceSupport nssupport = this.getNamespaceSupport(); 550 nssupport.pushContext(); 551 552 int n = m_prefixMappings.size(); 553 554 for (int i = 0; i < n; i++) 555 { 556 String prefix = (String )m_prefixMappings.elementAt(i++); 557 String nsURI = (String )m_prefixMappings.elementAt(i); 558 nssupport.declarePrefix(prefix, nsURI); 559 } 560 m_prefixMappings.removeAllElements(); 563 m_elementID++; 564 565 585 checkForFragmentID(attributes); 586 587 if (!m_shouldProcess) 588 return; 589 590 flushCharacters(); 591 592 pushSpaceHandling(attributes); 593 594 XSLTElementProcessor elemProcessor = getProcessorFor(uri, localName, 595 rawName); 596 597 if(null != elemProcessor) { 599 this.pushProcessor(elemProcessor); 600 elemProcessor.startElement(this, uri, localName, rawName, attributes); 601 } 602 else 603 { 604 m_shouldProcess = false; 605 popSpaceHandling(); 606 } 607 608 } 609 610 624 public void endElement(String uri, String localName, String rawName) 625 throws org.xml.sax.SAXException 626 { 627 628 m_elementID--; 629 630 if (!m_shouldProcess) 631 return; 632 633 if ((m_elementID + 1) == m_fragmentID) 634 m_shouldProcess = false; 635 636 flushCharacters(); 637 638 popSpaceHandling(); 639 640 XSLTElementProcessor p = getCurrentProcessor(); 641 642 p.endElement(this, uri, localName, rawName); 643 this.popProcessor(); 644 this.getNamespaceSupport().popContext(); 645 } 646 647 659 public void characters(char ch[], int start, int length) 660 throws org.xml.sax.SAXException 661 { 662 663 if (!m_shouldProcess) 664 return; 665 666 XSLTElementProcessor elemProcessor = getCurrentProcessor(); 667 XSLTElementDef def = elemProcessor.getElemDef(); 668 669 if (def.getType() != XSLTElementDef.T_PCDATA) 670 elemProcessor = def.getProcessorFor(null, "text()"); 671 672 if (null == elemProcessor) 673 { 674 675 if (!XMLCharacterRecognizer.isWhiteSpace(ch, start, length)) 677 error( 678 XSLMessages.createMessage(XSLTErrorResources.ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION, null),null); 680 } 681 else 682 elemProcessor.characters(this, ch, start, length); 683 } 684 685 697 public void ignorableWhitespace(char ch[], int start, int length) 698 throws org.xml.sax.SAXException 699 { 700 701 if (!m_shouldProcess) 702 return; 703 704 getCurrentProcessor().ignorableWhitespace(this, ch, start, length); 705 } 706 707 731 public void processingInstruction(String target, String data) 732 throws org.xml.sax.SAXException 733 { 734 if (!m_shouldProcess) 735 return; 736 737 746 String prefix="",ns="", localName=target; 747 int colon=target.indexOf(':'); 748 if(colon>=0) 749 { 750 ns=getNamespaceForPrefix(prefix=target.substring(0,colon)); 751 localName=target.substring(colon+1); 752 } 753 754 try 755 { 756 if( 764 "xalan-doc-cache-off".equals(target) || 765 "xalan:doc-cache-off".equals(target) || 766 ("doc-cache-off".equals(localName) && 767 ns.equals("org.apache.xalan.xslt.extensions.Redirect") ) 768 ) 769 { 770 if(!(m_elems.peek() instanceof ElemForEach)) 771 throw new TransformerException 772 ("xalan:doc-cache-off not allowed here!", 773 getLocator()); 774 ElemForEach elem = (ElemForEach)m_elems.peek(); 775 776 elem.m_doc_cache_off = true; 777 778 } 780 } 781 catch(Exception e) 782 { 783 } 786 787 788 flushCharacters(); 789 getCurrentProcessor().processingInstruction(this, target, data); 790 } 791 792 806 public void skippedEntity(String name) throws org.xml.sax.SAXException 807 { 808 809 if (!m_shouldProcess) 810 return; 811 812 getCurrentProcessor().skippedEntity(this, name); 813 } 814 815 828 public void warn(String msg, Object args[]) throws org.xml.sax.SAXException 829 { 830 831 String formattedMsg = XSLMessages.createWarning(msg, args); 832 SAXSourceLocator locator = getLocator(); 833 ErrorListener handler = m_stylesheetProcessor.getErrorListener(); 834 835 try 836 { 837 if (null != handler) 838 handler.warning(new TransformerException (formattedMsg, locator)); 839 } 840 catch (TransformerException te) 841 { 842 throw new org.xml.sax.SAXException (te); 843 } 844 } 845 846 855 private void assertion(boolean condition, String msg) throws RuntimeException 856 { 857 if (!condition) 858 throw new RuntimeException (msg); 859 } 860 861 874 protected void error(String msg, Exception e) 875 throws org.xml.sax.SAXException 876 { 877 878 SAXSourceLocator locator = getLocator(); 879 ErrorListener handler = m_stylesheetProcessor.getErrorListener(); 880 TransformerException pe; 881 882 if (!(e instanceof TransformerException )) 883 { 884 pe = (null == e) 885 ? new TransformerException (msg, locator) 886 : new TransformerException (msg, locator, e); 887 } 888 else 889 pe = (TransformerException ) e; 890 891 if (null != handler) 892 { 893 try 894 { 895 handler.error(pe); 896 } 897 catch (TransformerException te) 898 { 899 throw new org.xml.sax.SAXException (te); 900 } 901 } 902 else 903 throw new org.xml.sax.SAXException (pe); 904 } 905 906 921 protected void error(String msg, Object args[], Exception e) 922 throws org.xml.sax.SAXException 923 { 924 925 String formattedMsg = XSLMessages.createMessage(msg, args); 926 927 error(formattedMsg, e); 928 } 929 930 940 public void warning(org.xml.sax.SAXParseException e) 941 throws org.xml.sax.SAXException 942 { 943 944 String formattedMsg = e.getMessage(); 945 SAXSourceLocator locator = getLocator(); 946 ErrorListener handler = m_stylesheetProcessor.getErrorListener(); 947 948 try 949 { 950 handler.warning(new TransformerException (formattedMsg, locator)); 951 } 952 catch (TransformerException te) 953 { 954 throw new org.xml.sax.SAXException (te); 955 } 956 } 957 958 968 public void error(org.xml.sax.SAXParseException e) 969 throws org.xml.sax.SAXException 970 { 971 972 String formattedMsg = e.getMessage(); 973 SAXSourceLocator locator = getLocator(); 974 ErrorListener handler = m_stylesheetProcessor.getErrorListener(); 975 976 try 977 { 978 handler.error(new TransformerException (formattedMsg, locator)); 979 } 980 catch (TransformerException te) 981 { 982 throw new org.xml.sax.SAXException (te); 983 } 984 } 985 986 996 public void fatalError(org.xml.sax.SAXParseException e) 997 throws org.xml.sax.SAXException 998 { 999 1000 String formattedMsg = e.getMessage(); 1001 SAXSourceLocator locator = getLocator(); 1002 ErrorListener handler = m_stylesheetProcessor.getErrorListener(); 1003 1004 try 1005 { 1006 handler.fatalError(new TransformerException (formattedMsg, locator)); 1007 } 1008 catch (TransformerException te) 1009 { 1010 throw new org.xml.sax.SAXException (te); 1011 } 1012 } 1013 1014 1019 private boolean m_shouldProcess = true; 1020 1021 1027 private String m_fragmentIDString; 1028 1029 1036 private int m_elementID = 0; 1037 1038 1042 private int m_fragmentID = 0; 1043 1044 1050 private void checkForFragmentID(Attributes attributes) 1051 { 1052 1053 if (!m_shouldProcess) 1054 { 1055 if ((null != attributes) && (null != m_fragmentIDString)) 1056 { 1057 int n = attributes.getLength(); 1058 1059 for (int i = 0; i < n; i++) 1060 { 1061 String name = attributes.getQName(i); 1062 1063 if (name.equals(Constants.ATTRNAME_ID)) 1064 { 1065 String val = attributes.getValue(i); 1066 1067 if (val.equalsIgnoreCase(m_fragmentIDString)) 1068 { 1069 m_shouldProcess = true; 1070 m_fragmentID = m_elementID; 1071 } 1072 } 1073 } 1074 } 1075 } 1076 } 1077 1078 1081 private TransformerFactoryImpl m_stylesheetProcessor; 1082 1083 1089 TransformerFactoryImpl getStylesheetProcessor() 1090 { 1091 return m_stylesheetProcessor; 1092 } 1093 1094 1098 static final int STYPE_ROOT = 1; 1099 1100 1104 static final int STYPE_INCLUDE = 2; 1105 1106 1110 static final int STYPE_IMPORT = 3; 1111 1112 1113 private int m_stylesheetType = STYPE_ROOT; 1114 1115 1121 int getStylesheetType() 1122 { 1123 return m_stylesheetType; 1124 } 1125 1126 1132 void setStylesheetType(int type) 1133 { 1134 m_stylesheetType = type; 1135 } 1136 1137 1140 private Stack m_stylesheets = new Stack (); 1141 1142 1148 Stylesheet getStylesheet() 1149 { 1150 return (m_stylesheets.size() == 0) 1151 ? null : (Stylesheet) m_stylesheets.peek(); 1152 } 1153 1154 1159 Stylesheet getLastPoppedStylesheet() 1160 { 1161 return m_lastPoppedStylesheet; 1162 } 1163 1164 1169 public StylesheetRoot getStylesheetRoot() 1170 { 1171 return m_stylesheetRoot; 1172 } 1173 1174 1175 StylesheetRoot m_stylesheetRoot; 1176 1177 1178 Stylesheet m_lastPoppedStylesheet; 1179 1180 1187 public void pushStylesheet(Stylesheet s) 1188 { 1189 1190 if (m_stylesheets.size() == 0) 1191 m_stylesheetRoot = (StylesheetRoot) s; 1192 1193 m_stylesheets.push(s); 1194 } 1195 1196 1203 Stylesheet popStylesheet() 1204 { 1205 1206 if (!m_stylesheetLocatorStack.isEmpty()) 1210 m_stylesheetLocatorStack.pop(); 1211 1212 if (!m_stylesheets.isEmpty()) 1213 m_lastPoppedStylesheet = (Stylesheet) m_stylesheets.pop(); 1214 1215 return m_lastPoppedStylesheet; 1217 } 1218 1219 1222 private Stack m_processors = new Stack (); 1223 1224 1229 XSLTElementProcessor getCurrentProcessor() 1230 { 1231 return (XSLTElementProcessor) m_processors.peek(); 1232 } 1233 1234 1239 void pushProcessor(XSLTElementProcessor processor) 1240 { 1241 m_processors.push(processor); 1242 } 1243 1244 1248 XSLTElementProcessor popProcessor() 1249 { 1250 return (XSLTElementProcessor) m_processors.pop(); 1251 } 1252 1253 1259 private XSLTSchema m_schema = new XSLTSchema(); 1260 1261 1267 XSLTSchema getSchema() 1268 { 1269 return m_schema; 1270 } 1271 1272 1275 private Stack m_elems = new Stack (); 1276 1277 1281 ElemTemplateElement getElemTemplateElement() 1282 { 1283 1284 try 1285 { 1286 return (ElemTemplateElement) m_elems.peek(); 1287 } 1288 catch (java.util.EmptyStackException ese) 1289 { 1290 return null; 1291 } 1292 } 1293 1294 1297 private int m_docOrderCount = 0; 1298 1299 1302 int nextUid() 1303 { 1304 return m_docOrderCount++; 1305 } 1306 1307 1315 void pushElemTemplateElement(ElemTemplateElement elem) 1316 { 1317 1318 if (elem.getUid() == -1) 1319 elem.setUid(nextUid()); 1320 1321 m_elems.push(elem); 1322 } 1323 1324 1328 ElemTemplateElement popElemTemplateElement() 1329 { 1330 return (ElemTemplateElement) m_elems.pop(); 1331 } 1332 1333 1337 Stack m_baseIdentifiers = new Stack (); 1338 1339 1347 void pushBaseIndentifier(String baseID) 1348 { 1349 1350 if (null != baseID) 1351 { 1352 int posOfHash = baseID.indexOf('#'); 1353 1354 if (posOfHash > -1) 1355 { 1356 m_fragmentIDString = baseID.substring(posOfHash + 1); 1357 m_shouldProcess = false; 1358 } 1359 else 1360 m_shouldProcess = true; 1361 } 1362 else 1363 m_shouldProcess = true; 1364 1365 m_baseIdentifiers.push(baseID); 1366 } 1367 1368 1372 String popBaseIndentifier() 1373 { 1374 return (String ) m_baseIdentifiers.pop(); 1375 } 1376 1377 1382 public String getBaseIdentifier() 1383 { 1384 1385 String base = (String ) (m_baseIdentifiers.isEmpty() 1389 ? null : m_baseIdentifiers.peek()); 1390 1391 if (null == base) 1393 { 1394 SourceLocator locator = getLocator(); 1395 1396 base = (null == locator) ? "" : locator.getSystemId(); 1397 } 1398 1399 return base; 1400 } 1401 1402 1406 private Stack m_stylesheetLocatorStack = new Stack (); 1407 1408 1413 public SAXSourceLocator getLocator() 1414 { 1415 1416 if (m_stylesheetLocatorStack.isEmpty()) 1417 { 1418 SAXSourceLocator locator = new SAXSourceLocator(); 1419 1420 locator.setSystemId(this.getStylesheetProcessor().getDOMsystemID()); 1421 1422 return locator; 1423 1424 } 1426 1427 return ((SAXSourceLocator) m_stylesheetLocatorStack.peek()); 1428 } 1429 1430 1434 private Stack m_importStack = new Stack (); 1435 1436 1442 void pushImportURL(String hrefUrl) 1443 { 1444 m_importStack.push(hrefUrl); 1445 } 1446 1447 1455 boolean importStackContains(String hrefUrl) 1456 { 1457 return stackContains(m_importStack, hrefUrl); 1458 } 1459 1460 1465 String popImportURL() 1466 { 1467 return (String ) m_importStack.pop(); 1468 } 1469 1470 1474 private boolean warnedAboutOldXSLTNamespace = false; 1475 1476 1477 Stack m_nsSupportStack = new Stack (); 1478 1479 1482 void pushNewNamespaceSupport() 1483 { 1484 m_nsSupportStack.push(new NamespaceSupport2()); 1485 } 1486 1487 1491 void popNamespaceSupport() 1492 { 1493 m_nsSupportStack.pop(); 1494 } 1495 1496 1502 NamespaceSupport getNamespaceSupport() 1503 { 1504 return (NamespaceSupport ) m_nsSupportStack.peek(); 1505 } 1506 1507 1512 private Node m_originatingNode; 1513 1514 1520 public void setOriginatingNode(Node n) 1521 { 1522 m_originatingNode = n; 1523 } 1524 1525 1531 public Node getOriginatingNode() 1532 { 1533 return m_originatingNode; 1534 } 1535 1536 1540 private BoolStack m_spacePreserveStack = new BoolStack(); 1541 1542 1548 boolean isSpacePreserve() 1549 { 1550 return m_spacePreserveStack.peek(); 1551 } 1552 1553 1556 void popSpaceHandling() 1557 { 1558 m_spacePreserveStack.pop(); 1559 } 1560 1561 1566 void pushSpaceHandling(boolean b) 1567 throws org.xml.sax.SAXParseException 1568 { 1569 m_spacePreserveStack.push(b); 1570 } 1571 1572 1578 void pushSpaceHandling(Attributes attrs) 1579 throws org.xml.sax.SAXParseException 1580 { 1581 String value = attrs.getValue("xml:space"); 1582 if(null == value) 1583 { 1584 m_spacePreserveStack.push(m_spacePreserveStack.peekOrFalse()); 1585 } 1586 else if(value.equals("preserve")) 1587 { 1588 m_spacePreserveStack.push(true); 1589 } 1590 else if(value.equals("default")) 1591 { 1592 m_spacePreserveStack.push(false); 1593 } 1594 else 1595 { 1596 SAXSourceLocator locator = getLocator(); 1597 ErrorListener handler = m_stylesheetProcessor.getErrorListener(); 1598 1599 try 1600 { 1601 handler.error(new TransformerException (XSLMessages.createMessage(XSLTErrorResources.ER_ILLEGAL_XMLSPACE_VALUE, null), locator)); } 1603 catch (TransformerException te) 1604 { 1605 throw new org.xml.sax.SAXParseException (te.getMessage(), locator, te); 1606 } 1607 m_spacePreserveStack.push(m_spacePreserveStack.peek()); 1608 } 1609 } 1610 1611 private double getElemVersion() 1612 { 1613 ElemTemplateElement elem = getElemTemplateElement(); 1614 double version = -1; 1615 while ((version == -1 || version == Constants.XSLTVERSUPPORTED) && elem != null) 1616 { 1617 try{ 1618 version = Double.valueOf(elem.getVersion()).doubleValue(); 1619 } 1620 catch (Exception ex) 1621 { 1622 version = -1; 1623 } 1624 elem = elem.getParentElem(); 1625 } 1626 return (version == -1)? Constants.XSLTVERSUPPORTED : version; 1627 } 1628 1631 public boolean handlesNullPrefixes() { 1632 return false; 1633 } 1634 1635} 1636 1637 1638 1639 | Popular Tags |