1 16 19 package org.apache.xalan.templates; 20 21 import java.io.Serializable ; 22 import java.util.Enumeration ; 23 import java.util.Vector ; 24 25 import javax.xml.transform.SourceLocator ; 26 import javax.xml.transform.TransformerException ; 27 28 import org.apache.xalan.res.XSLMessages; 29 import org.apache.xalan.res.XSLTErrorResources; 30 import org.apache.xalan.transformer.TransformerImpl; 31 import org.apache.xml.serializer.SerializationHandler; 32 import org.apache.xml.utils.PrefixResolver; 33 import org.apache.xml.utils.UnImplNode; 34 import org.apache.xpath.ExpressionNode; 35 import org.apache.xpath.WhitespaceStrippingElementMatcher; 36 37 import org.w3c.dom.DOMException ; 38 import org.w3c.dom.Document ; 39 import org.w3c.dom.Node ; 40 import org.w3c.dom.NodeList ; 41 42 import org.xml.sax.helpers.NamespaceSupport ; 43 44 57 public class ElemTemplateElement extends UnImplNode 58 implements PrefixResolver, Serializable , ExpressionNode, 59 WhitespaceStrippingElementMatcher, XSLTVisitable 60 { 61 62 72 public ElemTemplateElement(){} 73 74 79 public boolean isCompiledTemplate() 80 { 81 return false; 82 } 83 84 91 public int getXSLToken() 92 { 93 return Constants.ELEMNAME_UNDEFINED; 94 } 95 96 101 public String getNodeName() 102 { 103 return "Unknown XSLT Element"; 104 } 105 106 112 public String getLocalName() 113 { 114 115 return getNodeName(); 116 } 117 118 119 127 public void runtimeInit(TransformerImpl transformer) throws TransformerException {} 128 129 139 public void execute( 140 TransformerImpl transformer) 141 throws TransformerException {} 142 143 151 public StylesheetComposed getStylesheetComposed() 152 { 153 return m_parentNode.getStylesheetComposed(); 154 } 155 156 163 public Stylesheet getStylesheet() 164 { 165 return (null==m_parentNode) ? null : m_parentNode.getStylesheet(); 166 } 167 168 176 public StylesheetRoot getStylesheetRoot() 177 { 178 return m_parentNode.getStylesheetRoot(); 179 } 180 181 185 public void recompose(StylesheetRoot root) throws TransformerException 186 { 187 } 188 189 195 public void compose(StylesheetRoot sroot) throws TransformerException 196 { 197 resolvePrefixTables(); 198 ElemTemplateElement t = getFirstChildElem(); 199 m_hasTextLitOnly = ((t != null) 200 && (t.getXSLToken() == Constants.ELEMNAME_TEXTLITERALRESULT) 201 && (t.getNextSiblingElem() == null)); 202 203 StylesheetRoot.ComposeState cstate = sroot.getComposeState(); 204 cstate.pushStackMark(); 205 } 206 207 210 public void endCompose(StylesheetRoot sroot) throws TransformerException 211 { 212 StylesheetRoot.ComposeState cstate = sroot.getComposeState(); 213 cstate.popStackMark(); 214 } 215 216 222 public void error(String msg, Object [] args) 223 { 224 225 String themsg = XSLMessages.createMessage(msg, args); 226 227 throw new RuntimeException (XSLMessages.createMessage( 228 XSLTErrorResources.ER_ELEMTEMPLATEELEM_ERR, 229 new Object []{ themsg })); 230 } 231 232 238 public void error(String msg) 239 { 240 error(msg, null); 241 } 242 243 244 258 public Node appendChild(Node newChild) throws DOMException 259 { 260 261 if (null == newChild) 262 { 263 error(XSLTErrorResources.ER_NULL_CHILD, null); } 265 266 ElemTemplateElement elem = (ElemTemplateElement) newChild; 267 268 if (null == m_firstChild) 269 { 270 m_firstChild = elem; 271 } 272 else 273 { 274 ElemTemplateElement last = (ElemTemplateElement) getLastChild(); 275 276 last.m_nextSibling = elem; 277 } 278 279 elem.m_parentNode = this; 280 281 return newChild; 282 } 283 284 296 public ElemTemplateElement appendChild(ElemTemplateElement elem) 297 { 298 299 if (null == elem) 300 { 301 error(XSLTErrorResources.ER_NULL_CHILD, null); } 303 304 if (null == m_firstChild) 305 { 306 m_firstChild = elem; 307 } 308 else 309 { 310 ElemTemplateElement last = getLastChildElem(); 311 312 last.m_nextSibling = elem; 313 } 314 315 elem.setParentElem(this); 316 317 return elem; 318 } 319 320 321 326 public boolean hasChildNodes() 327 { 328 return (null != m_firstChild); 329 } 330 331 336 public short getNodeType() 337 { 338 return org.w3c.dom.Node.ELEMENT_NODE; 339 } 340 341 346 public NodeList getChildNodes() 347 { 348 return this; 349 } 350 351 365 public ElemTemplateElement removeChild(ElemTemplateElement childETE) 366 { 367 368 if (childETE == null || childETE.m_parentNode != this) 369 return null; 370 371 if (childETE == m_firstChild) 373 m_firstChild = childETE.m_nextSibling; 374 else 375 { 376 ElemTemplateElement prev = childETE.getPreviousSiblingElem(); 377 378 prev.m_nextSibling = childETE.m_nextSibling; 379 } 380 381 childETE.m_parentNode = null; 383 childETE.m_nextSibling = null; 384 385 return childETE; 386 } 387 388 398 public Node replaceChild(Node newChild, Node oldChild) throws DOMException 399 { 400 401 if (oldChild == null || oldChild.getParentNode() != this) 402 return null; 403 404 ElemTemplateElement newChildElem = ((ElemTemplateElement) newChild); 405 ElemTemplateElement oldChildElem = ((ElemTemplateElement) oldChild); 406 407 ElemTemplateElement prev = 409 (ElemTemplateElement) oldChildElem.getPreviousSibling(); 410 411 if (null != prev) 412 prev.m_nextSibling = newChildElem; 413 414 if (m_firstChild == oldChildElem) 416 m_firstChild = newChildElem; 417 418 newChildElem.m_parentNode = this; 419 oldChildElem.m_parentNode = null; 420 newChildElem.m_nextSibling = oldChildElem.m_nextSibling; 421 oldChildElem.m_nextSibling = null; 422 423 return newChildElem; 426 } 427 428 438 public Node insertBefore(Node newChild, Node refChild) throws DOMException 439 { 440 if(null == refChild) 441 { 442 appendChild(newChild); 443 return newChild; 444 } 445 446 if(newChild == refChild) 447 { 448 return newChild; 450 } 451 452 Node node = m_firstChild; 453 Node prev = null; 454 boolean foundit = false; 455 456 while (null != node) 457 { 458 if(newChild == node) 460 { 461 if(null != prev) 462 ((ElemTemplateElement)prev).m_nextSibling = 463 (ElemTemplateElement)node.getNextSibling(); 464 else 465 m_firstChild = (ElemTemplateElement)node.getNextSibling(); 466 node = node.getNextSibling(); 467 continue; } 469 if(refChild == node) 470 { 471 if(null != prev) 472 { 473 ((ElemTemplateElement)prev).m_nextSibling = (ElemTemplateElement)newChild; 474 } 475 else 476 { 477 m_firstChild = (ElemTemplateElement)newChild; 478 } 479 ((ElemTemplateElement)newChild).m_nextSibling = (ElemTemplateElement)refChild; 480 ((ElemTemplateElement)newChild).setParentElem(this); 481 prev = newChild; 482 node = node.getNextSibling(); 483 foundit = true; 484 continue; 485 } 486 prev = node; 487 node = node.getNextSibling(); 488 } 489 490 if(!foundit) 491 throw new DOMException (DOMException.NOT_FOUND_ERR, 492 "refChild was not found in insertBefore method!"); 493 else 494 return newChild; 495 } 496 497 498 508 public ElemTemplateElement replaceChild(ElemTemplateElement newChildElem, 509 ElemTemplateElement oldChildElem) 510 { 511 512 if (oldChildElem == null || oldChildElem.getParentElem() != this) 513 return null; 514 515 ElemTemplateElement prev = 517 oldChildElem.getPreviousSiblingElem(); 518 519 if (null != prev) 520 prev.m_nextSibling = newChildElem; 521 522 if (m_firstChild == oldChildElem) 524 m_firstChild = newChildElem; 525 526 newChildElem.m_parentNode = this; 527 oldChildElem.m_parentNode = null; 528 newChildElem.m_nextSibling = oldChildElem.m_nextSibling; 529 oldChildElem.m_nextSibling = null; 530 531 return newChildElem; 534 } 535 536 541 public int getLength() 542 { 543 544 int count = 0; 548 549 for (ElemTemplateElement node = m_firstChild; node != null; 550 node = node.m_nextSibling) 551 { 552 count++; 553 } 554 555 return count; 556 } 558 565 public Node item(int index) 566 { 567 568 ElemTemplateElement node = m_firstChild; 572 573 for (int i = 0; i < index && node != null; i++) 574 { 575 node = node.m_nextSibling; 576 } 577 578 return node; 579 } 581 586 public Document getOwnerDocument() 587 { 588 return getStylesheet(); 589 } 590 591 596 public ElemTemplate getOwnerXSLTemplate() 597 { 598 ElemTemplateElement el = this; 599 int type = el.getXSLToken(); 600 while((null != el) && (type != Constants.ELEMNAME_TEMPLATE)) 601 { 602 el = el.getParentElem(); 603 if(null != el) 604 type = el.getXSLToken(); 605 } 606 return (ElemTemplate)el; 607 } 608 609 610 615 public String getTagName() 616 { 617 return getNodeName(); 618 } 619 620 624 public boolean hasTextLitOnly() 625 { 626 return m_hasTextLitOnly; 627 } 628 629 634 public String getBaseIdentifier() 635 { 636 637 return this.getSystemId(); 639 } 640 641 643 private int m_lineNumber; 644 645 647 private int m_endLineNumber; 648 649 656 public int getEndLineNumber() 657 { 658 return m_endLineNumber; 659 } 660 661 668 public int getLineNumber() 669 { 670 return m_lineNumber; 671 } 672 673 675 private int m_columnNumber; 676 677 679 private int m_endColumnNumber; 680 681 689 public int getEndColumnNumber() 690 { 691 return m_endColumnNumber; 692 } 693 694 702 public int getColumnNumber() 703 { 704 return m_columnNumber; 705 } 706 707 714 public String getPublicId() 715 { 716 return (null != m_parentNode) ? m_parentNode.getPublicId() : null; 717 } 718 719 729 public String getSystemId() 730 { 731 Stylesheet sheet=getStylesheet(); 732 return (sheet==null) ? null : sheet.getHref(); 733 } 734 735 740 public void setLocaterInfo(SourceLocator locator) 741 { 742 m_lineNumber = locator.getLineNumber(); 743 m_columnNumber = locator.getColumnNumber(); 744 } 745 746 751 public void setEndLocaterInfo(SourceLocator locator) 752 { 753 m_endLineNumber = locator.getLineNumber(); 754 m_endColumnNumber = locator.getColumnNumber(); 755 } 756 757 762 private boolean m_defaultSpace = true; 763 764 768 private boolean m_hasTextLitOnly = false; 769 770 774 protected boolean m_hasVariableDecl = false; 775 776 public boolean hasVariableDecl() 777 { 778 return m_hasVariableDecl; 779 } 780 781 792 public void setXmlSpace(int v) 793 { 794 m_defaultSpace = ((Constants.ATTRVAL_STRIP == v) ? true : false); 795 } 796 797 807 public boolean getXmlSpace() 808 { 809 return m_defaultSpace; 810 } 811 812 816 private Vector m_declaredPrefixes; 817 818 825 public Vector getDeclaredPrefixes() 826 { 827 return m_declaredPrefixes; 828 } 829 830 840 public void setPrefixes(NamespaceSupport nsSupport) throws TransformerException 841 { 842 setPrefixes(nsSupport, false); 843 } 844 845 856 public void setPrefixes(NamespaceSupport nsSupport, boolean excludeXSLDecl) 857 throws TransformerException 858 { 859 860 Enumeration decls = nsSupport.getDeclaredPrefixes(); 861 862 while (decls.hasMoreElements()) 863 { 864 String prefix = (String ) decls.nextElement(); 865 866 if (null == m_declaredPrefixes) 867 m_declaredPrefixes = new Vector (); 868 869 String uri = nsSupport.getURI(prefix); 870 871 if (excludeXSLDecl && uri.equals(Constants.S_XSLNAMESPACEURL)) 872 continue; 873 874 XMLNSDecl decl = new XMLNSDecl(prefix, uri, false); 876 877 m_declaredPrefixes.addElement(decl); 878 } 879 } 880 881 891 public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context) 892 { 893 this.error(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, null); 894 895 return null; 896 } 897 898 912 public String getNamespaceForPrefix(String prefix) 913 { 914 919 Vector nsDecls = m_declaredPrefixes; 920 921 if (null != nsDecls) 922 { 923 int n = nsDecls.size(); 924 if(prefix.equals(Constants.ATTRVAL_DEFAULT_PREFIX)) 925 { 926 prefix = ""; 927 } 928 929 for (int i = 0; i < n; i++) 930 { 931 XMLNSDecl decl = (XMLNSDecl) nsDecls.elementAt(i); 932 933 if (prefix.equals(decl.getPrefix())) 934 return decl.getURI(); 935 } 936 } 937 938 if (null != m_parentNode) 940 return m_parentNode.getNamespaceForPrefix(prefix); 941 942 if("xml".equals(prefix)) 946 return "http://www.w3.org/XML/1998/namespace"; 947 948 return null; 950 } 951 952 957 Vector m_prefixTable; 958 959 965 public Vector getPrefixes() 966 { 967 return m_prefixTable; 968 } 969 970 980 public boolean containsExcludeResultPrefix(String prefix, String uri) 981 { 982 ElemTemplateElement parent = this.getParentElem(); 983 if(null != parent) 984 return parent.containsExcludeResultPrefix(prefix, uri); 985 986 return false; 987 } 988 989 1001 private boolean excludeResultNSDecl(String prefix, String uri) 1002 throws TransformerException 1003 { 1004 1005 if (uri != null) 1006 { 1007 if (uri.equals(Constants.S_XSLNAMESPACEURL) 1008 || getStylesheet().containsExtensionElementURI(uri)) 1009 return true; 1010 1011 if (containsExcludeResultPrefix(prefix, uri)) 1012 return true; 1013 } 1014 1015 return false; 1016 } 1017 1018 1029 public void resolvePrefixTables() throws TransformerException 1030 { 1031 m_prefixTable = null; 1033 1034 if (null != this.m_declaredPrefixes) 1039 { 1040 StylesheetRoot stylesheet = this.getStylesheetRoot(); 1041 1042 int n = m_declaredPrefixes.size(); 1045 1046 for (int i = 0; i < n; i++) 1047 { 1048 XMLNSDecl decl = (XMLNSDecl) m_declaredPrefixes.elementAt(i); 1049 String prefix = decl.getPrefix(); 1050 String uri = decl.getURI(); 1051 if(null == uri) 1052 uri = ""; 1053 boolean shouldExclude = excludeResultNSDecl(prefix, uri); 1054 1055 if (null == m_prefixTable) 1057 m_prefixTable = new Vector (); 1058 1059 NamespaceAlias nsAlias = stylesheet.getNamespaceAliasComposed(uri); 1060 if(null != nsAlias) 1061 { 1062 1065 decl = new XMLNSDecl(nsAlias.getStylesheetPrefix(), 1069 nsAlias.getResultNamespace(), shouldExclude); 1070 } 1071 else 1072 decl = new XMLNSDecl(prefix, uri, shouldExclude); 1073 1074 m_prefixTable.addElement(decl); 1075 1076 } 1077 } 1078 1079 ElemTemplateElement parent = this.getParentNodeElem(); 1080 1081 if (null != parent) 1082 { 1083 1084 Vector prefixes = parent.m_prefixTable; 1086 1087 if (null == m_prefixTable && !needToCheckExclude()) 1088 { 1089 1090 this.m_prefixTable = parent.m_prefixTable; 1092 } 1093 else 1094 { 1095 1096 int n = prefixes.size(); 1098 1099 for (int i = 0; i < n; i++) 1100 { 1101 XMLNSDecl decl = (XMLNSDecl) prefixes.elementAt(i); 1102 boolean shouldExclude = excludeResultNSDecl(decl.getPrefix(), 1103 decl.getURI()); 1104 1105 if (shouldExclude != decl.getIsExcluded()) 1106 { 1107 decl = new XMLNSDecl(decl.getPrefix(), decl.getURI(), 1108 shouldExclude); 1109 } 1110 1111 addOrReplaceDecls(decl); 1113 } 1114 } 1115 } 1116 else if (null == m_prefixTable) 1117 { 1118 1119 m_prefixTable = new Vector (); 1121 } 1122 } 1123 1124 1130 void addOrReplaceDecls(XMLNSDecl newDecl) 1131 { 1132 int n = m_prefixTable.size(); 1133 1134 for (int i = n - 1; i >= 0; i--) 1135 { 1136 XMLNSDecl decl = (XMLNSDecl) m_prefixTable.elementAt(i); 1137 1138 if (decl.getPrefix().equals(newDecl.getPrefix())) 1139 { 1140 return; 1141 } 1142 } 1143 m_prefixTable.addElement(newDecl); 1144 1145 } 1146 1147 1151 boolean needToCheckExclude() 1152 { 1153 return false; 1154 } 1155 1156 1164 void executeNSDecls(TransformerImpl transformer) throws TransformerException 1165 { 1166 executeNSDecls(transformer, null); 1167 } 1168 1169 1178 void executeNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException 1179 { 1180 try 1181 { 1182 if (null != m_prefixTable) 1183 { 1184 SerializationHandler rhandler = transformer.getResultTreeHandler(); 1185 int n = m_prefixTable.size(); 1186 1187 for (int i = n - 1; i >= 0; i--) 1188 { 1189 XMLNSDecl decl = (XMLNSDecl) m_prefixTable.elementAt(i); 1190 1191 if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix))) 1192 { 1193 rhandler.startPrefixMapping(decl.getPrefix(), decl.getURI(), true); 1194 } 1195 } 1196 } 1197 } 1198 catch(org.xml.sax.SAXException se) 1199 { 1200 throw new TransformerException (se); 1201 } 1202 } 1203 1204 1212 void unexecuteNSDecls(TransformerImpl transformer) throws TransformerException 1213 { 1214 unexecuteNSDecls(transformer, null); 1215 } 1216 1217 1226 void unexecuteNSDecls(TransformerImpl transformer, String ignorePrefix) throws TransformerException 1227 { 1228 1229 try 1230 { 1231 if (null != m_prefixTable) 1232 { 1233 SerializationHandler rhandler = transformer.getResultTreeHandler(); 1234 int n = m_prefixTable.size(); 1235 1236 for (int i = 0; i < n; i++) 1237 { 1238 XMLNSDecl decl = (XMLNSDecl) m_prefixTable.elementAt(i); 1239 1240 if (!decl.getIsExcluded() && !(null != ignorePrefix && decl.getPrefix().equals(ignorePrefix))) 1241 { 1242 rhandler.endPrefixMapping(decl.getPrefix()); 1243 } 1244 } 1245 } 1246 } 1247 catch(org.xml.sax.SAXException se) 1248 { 1249 throw new TransformerException (se); 1250 } 1251 } 1252 1253 1255 protected int m_docOrderNumber = -1; 1256 1257 1262 public void setUid(int i) 1263 { 1264 m_docOrderNumber = i; 1265 } 1266 1267 1272 public int getUid() 1273 { 1274 return m_docOrderNumber; 1275 } 1276 1277 1278 1282 protected ElemTemplateElement m_parentNode; 1283 1284 1289 public Node getParentNode() 1290 { 1291 return m_parentNode; 1292 } 1293 1294 1299 public ElemTemplateElement getParentElem() 1300 { 1301 return m_parentNode; 1302 } 1303 1304 1309 public void setParentElem(ElemTemplateElement p) 1310 { 1311 m_parentNode = p; 1312 } 1313 1314 1318 ElemTemplateElement m_nextSibling; 1319 1320 1325 public Node getNextSibling() 1326 { 1327 return m_nextSibling; 1328 } 1329 1330 1339 public Node getPreviousSibling() 1340 { 1341 1342 Node walker = getParentNode(), prev = null; 1343 1344 if (walker != null) 1345 for (walker = walker.getFirstChild(); walker != null; 1346 prev = walker, walker = walker.getNextSibling()) 1347 { 1348 if (walker == this) 1349 return prev; 1350 } 1351 1352 return null; 1353 } 1354 1355 1364 public ElemTemplateElement getPreviousSiblingElem() 1365 { 1366 1367 ElemTemplateElement walker = getParentNodeElem(); 1368 ElemTemplateElement prev = null; 1369 1370 if (walker != null) 1371 for (walker = walker.getFirstChildElem(); walker != null; 1372 prev = walker, walker = walker.getNextSiblingElem()) 1373 { 1374 if (walker == this) 1375 return prev; 1376 } 1377 1378 return null; 1379 } 1380 1381 1382 1387 public ElemTemplateElement getNextSiblingElem() 1388 { 1389 return m_nextSibling; 1390 } 1391 1392 1397 public ElemTemplateElement getParentNodeElem() 1398 { 1399 return m_parentNode; 1400 } 1401 1402 1403 1407 ElemTemplateElement m_firstChild; 1408 1409 1414 public Node getFirstChild() 1415 { 1416 return m_firstChild; 1417 } 1418 1419 1424 public ElemTemplateElement getFirstChildElem() 1425 { 1426 return m_firstChild; 1427 } 1428 1429 1434 public Node getLastChild() 1435 { 1436 1437 ElemTemplateElement lastChild = null; 1438 1439 for (ElemTemplateElement node = m_firstChild; node != null; 1440 node = node.m_nextSibling) 1441 { 1442 lastChild = node; 1443 } 1444 1445 return lastChild; 1446 } 1447 1448 1453 public ElemTemplateElement getLastChildElem() 1454 { 1455 1456 ElemTemplateElement lastChild = null; 1457 1458 for (ElemTemplateElement node = m_firstChild; node != null; 1459 node = node.m_nextSibling) 1460 { 1461 lastChild = node; 1462 } 1463 1464 return lastChild; 1465 } 1466 1467 1468 1469 transient private org.w3c.dom.Node m_DOMBackPointer; 1470 1471 1478 public org.w3c.dom.Node getDOMBackPointer() 1479 { 1480 return m_DOMBackPointer; 1481 } 1482 1483 1490 public void setDOMBackPointer(org.w3c.dom.Node n) 1491 { 1492 m_DOMBackPointer = n; 1493 } 1494 1495 1508 public int compareTo(Object o) throws ClassCastException { 1509 1510 ElemTemplateElement ro = (ElemTemplateElement) o; 1511 int roPrecedence = ro.getStylesheetComposed().getImportCountComposed(); 1512 int myPrecedence = this.getStylesheetComposed().getImportCountComposed(); 1513 1514 if (myPrecedence < roPrecedence) 1515 return -1; 1516 else if (myPrecedence > roPrecedence) 1517 return 1; 1518 else 1519 return this.getUid() - ro.getUid(); 1520 } 1521 1522 1533 public boolean shouldStripWhiteSpace( 1534 org.apache.xpath.XPathContext support, 1535 org.w3c.dom.Element targetElement) throws TransformerException 1536 { 1537 StylesheetRoot sroot = this.getStylesheetRoot(); 1538 return (null != sroot) ? sroot.shouldStripWhiteSpace(support, targetElement) :false; 1539 } 1540 1541 1547 public boolean canStripWhiteSpace() 1548 { 1549 StylesheetRoot sroot = this.getStylesheetRoot(); 1550 return (null != sroot) ? sroot.canStripWhiteSpace() : false; 1551 } 1552 1553 1557 public boolean canAcceptVariables() 1558 { 1559 return true; 1560 } 1561 1562 1564 1568 public void exprSetParent(ExpressionNode n) 1569 { 1570 setParentElem((ElemTemplateElement)n); 1573 } 1574 1575 1578 public ExpressionNode exprGetParent() 1579 { 1580 return getParentElem(); 1581 } 1582 1583 1588 public void exprAddChild(ExpressionNode n, int i) 1589 { 1590 appendChild((ElemTemplateElement)n); 1591 } 1592 1593 1595 public ExpressionNode exprGetChild(int i) 1596 { 1597 return (ExpressionNode)item(i); 1598 } 1599 1600 1601 public int exprGetNumChildren() 1602 { 1603 return getLength(); 1604 } 1605 1606 1613 protected boolean accept(XSLTVisitor visitor) 1614 { 1615 return visitor.visitInstruction(this); 1616 } 1617 1618 1621 public void callVisitors(XSLTVisitor visitor) 1622 { 1623 if(accept(visitor)) 1624 { 1625 callChildVisitors(visitor); 1626 } 1627 } 1628 1629 1633 protected void callChildVisitors(XSLTVisitor visitor, boolean callAttributes) 1634 { 1635 for (ElemTemplateElement node = m_firstChild; 1636 node != null; 1637 node = node.m_nextSibling) 1638 { 1639 node.callVisitors(visitor); 1640 } 1641 } 1642 1643 1647 protected void callChildVisitors(XSLTVisitor visitor) 1648 { 1649 callChildVisitors(visitor, true); 1650 } 1651 1652 1653 1656 public boolean handlesNullPrefixes() { 1657 return false; 1658 } 1659 1660} 1661 | Popular Tags |