/usr/include/xalanc/XSLT/ElemTemplateElement.hpp is in libxalan-c-dev 1.11-6ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD)
#define XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD
// Base include file. Must be first.
#include <xalanc/XSLT/XSLTDefinitions.hpp>
#include <xalanc/XalanDOM/XalanDOMString.hpp>
#include <xalanc/XalanDOM/XalanNode.hpp>
#include <xalanc/PlatformSupport/DOMStringHelper.hpp>
#include <xalanc/PlatformSupport/PrefixResolver.hpp>
#include <xalanc/PlatformSupport/XalanLocator.hpp>
#include <xalanc/XPath/XalanQNameByReference.hpp>
#include <xalanc/XSLT/NamespacesHandler.hpp>
#include "LocalMsgIndex.hpp"
XALAN_DECLARE_XERCES_CLASS(AttributeList)
XALAN_DECLARE_XERCES_CLASS(Locator)
XALAN_CPP_NAMESPACE_BEGIN
typedef XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType;
typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType;
XALAN_USING_XERCES(AttributeList)
XALAN_USING_XERCES(Locator)
class ElemTemplate;
class ElemTextLiteral;
class NamespacesHandler;
class Stylesheet;
class StylesheetConstructionContext;
class StylesheetExecutionContext;
class XPath;
class XALAN_XSLT_EXPORT ElemTemplateElement : public PrefixResolver
{
public:
/**
* Construct a template element instance.
*
* @param constructionContext context when object constructed
* @param stylesheetTree owning stylesheet
* @param lineNumber line in the XSLT file where the element occurs
* @param columnNumber column index in the XSLT file where the
* element occurs
* @param xslToken an integer representing the type of instance.
*/
ElemTemplateElement(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
XalanFileLoc lineNumber,
XalanFileLoc columnNumber,
int xslToken);
/**
* Special constructor used by dummy elements which do not exist in the
* final stylesheet.
*
* @param constructionContext context when object constructed
* @param stylesheetTree owning stylesheet
* @param baseURI The base URI of the XSLT file where the element occurs.
* @param lineNumber line in the XSLT file where the element occurs
* @param columnNumber column index in the XSLT file where the
* element occurs
* @param xslToken an integer representing the type of instance.
*/
ElemTemplateElement(
StylesheetConstructionContext& constructionContext,
Stylesheet& stylesheetTree,
int xslToken,
const XalanDOMString& baseURI = XalanDOMString(XalanMemMgrs::getDummyMemMgr()),
XalanFileLoc lineNumber = XalanLocator::getUnknownValue(),
XalanFileLoc columnNumber = XalanLocator::getUnknownValue());
virtual
~ElemTemplateElement();
/**
* Get the Locator for the node. This may return 0.
*
* @return The Locator for the node.
*/
virtual const Locator*
getLocator() const;
/**
* See if this is a xmlns attribute or in a non-XSLT.
*
* @param attrName qualified name of attribute
* @param atts attribute list where the element comes from (not used at
* this time)
* @param which index into the attribute list (not used at this time)
* @param constructionContext The current construction context
* @return true if this is a namespace name
*/
virtual bool
isAttrOK(
const XalanDOMChar* attrName,
const AttributeListType& atts,
XalanSize_t which,
StylesheetConstructionContext& constructionContext) const;
/**
* Tell whether or not this is a xml:space attribute and, if so, process it.
*
* @param elementName name of the element with the attribute
* @param aname name of the attribute in question
* @param atts attribute list that owns the attribute
* @param which index of the attribute into the attribute list
* @param constructionContext The current construction context
* @return true if this is a xml:space attribute
*/
bool
processSpaceAttr(
const XalanDOMChar* elementName,
const XalanDOMChar* aname,
const AttributeListType& atts,
XalanSize_t which,
StylesheetConstructionContext& constructionContext);
/**
* Validate that the string is an NCName.
*
* @param s name in question
* @return true if the string is a valid NCName according to XML rules
* @see http://www.w3.org/TR/REC-xml-names#NT-NCName
*/
static bool
isValidNCName(const XalanDOMString& s);
#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
/**
* Completes "pre-processing" before any sub-elements are invoked
* (i.e. children, attribute sets and templates). If there are
* no sub-elements it executes the primary function of the element.
*
* @param executionContext context to execute this element
*/
virtual const ElemTemplateElement*
startElement(StylesheetExecutionContext& executionContext) const;
/**
* Completes "post-processing" afer any sub-elements are invoked
* (i.e. children, attribute sets and templates). If there are
* no sub-elements it does nothing
*
* @param executionContext context to execute this element
*/
virtual void
endElement(StylesheetExecutionContext& executionContext) const;
/**
* Execute the element.
*
* @param execute context to execute this element
*/
virtual void
execute(StylesheetExecutionContext& executionContext) const;
/**
* Execute the children of this element.
*
* @param execute context to execute this element
*/
virtual void
executeChildren(StylesheetExecutionContext& executionContext) const;
/**
* Returns the element that invoked this element.
* @returns element that invoked this element.
*/
virtual const ElemTemplateElement*
getInvoker(StylesheetExecutionContext& executionContext) const;
#else
/**
* Execute the element's primary function. Subclasses of this function may
* recursively execute down the element tree.
*
* @param executionContext The current execution context
*/
virtual void
execute(StylesheetExecutionContext& executionContext) const;
/**
* Process the children of a template.
*
* @param processor XSLT processor instance
*/
virtual void
executeChildren(StylesheetExecutionContext& executionContext) const;
/**
* Set the current node and process the children of a template.
*
* @param processor XSLT processor instance
* @param sourceNode current node
*/
virtual void
executeChildren(
StylesheetExecutionContext& executionContext,
XalanNode* sourceNode) const;
/**
* Take the contents of a template element, process it, and
* convert it to a string. Returns a const reference to
* the resulting string value. Note that this may _not_ be
* the XalanDOMString instance passed in, if an optimization
* is available to return a pre-existing string.
*
* @param executionContext The current execution context
* @param result result of executing the elements children
* @result a reference to a string containing the result.
*/
const XalanDOMString&
childrenToString(
StylesheetExecutionContext& executionContext,
XalanDOMString& result) const;
/**
* Take the contents of a template element, process it, and
* convert it to a string. Then, add an attribute to the
* result tree using the provided name and the string value.
*
* @param executionContext The current execution context
* @param theName The name for the result attribute
*/
void
childrenToResultAttribute(
StylesheetExecutionContext& executionContext,
const XalanDOMString& theName) const;
/**
* Take the contents of a template element, process it, and
* convert it to a string. Then, add a comment to the
* result tree using the string value.
*
* @param executionContext The current execution context
*/
void
childrenToResultComment(StylesheetExecutionContext& executionContext) const;
/**
* Take the contents of a template element, process it, and
* convert it to a string. Then, add a processing instruction
* to the result tree using the string value, and the provided
* target.
*
* @param executionContext The current execution context
* @param theName The name for the result attribute
*/
void
childrenToResultPI(
StylesheetExecutionContext& executionContext,
const XalanDOMString& theTarget) const;
/**
* Get an integer representation of the element type.
*
* @return integer representation of the element, defined in the Constants
* class
* @see class Constants
*/
#endif
int
getXSLToken() const
{
return m_xslToken;
}
/**
* Tell if the element will generate text which is XML whitespace.
*
* @return true if the text is pure whitespace
*/
virtual bool
isWhitespace() const;
/**
* Get a string for the name of the element. Useful for debugging purposes,
* and error reporting.
*
* @return A string containing the name of the element.
*/
virtual const XalanDOMString&
getElementName() const = 0;
/**
* Get the QName associated with any name attribute of this element.
* If the element has no name attribute, this will be an empty QName.
*
* @return A string containing the name of the element.
*/
virtual const XalanQName&
getNameAttribute() const;
/**
* Called during compilation when an instance is not parented by
* another element, and thus, is a child of the stylesheet..
*
* @param constructionContext The current construction context
* @param theStylesheet The owning stylesheet
* @return nothing
*/
virtual void
addToStylesheet(
StylesheetConstructionContext& constructionContext,
Stylesheet& theStylesheet);
/**
* Called during compilation to process xsl:sort elements in
* the stylesheet.
*
* @param constructionContext The current construction context
* @param theStylesheet The owning stylesheet
* @param atts The list of attributes for the sort element
* @param locator A Locator instance for error reporting, if available.
*
* @return nothing
*/
virtual void
processSortElement(
StylesheetConstructionContext& constructionContext,
Stylesheet& theStylesheet,
const AttributeListType& atts,
const Locator* locator = 0);
/**
* Sets a flag indicating this is the default template
*
* @param value The value of flag.
*/
virtual void
setDefaultTemplate(bool value);
/**
* Get the namespaces handler for this element.
*
* @return The element's NamespacesHandler instance.
*/
const NamespacesHandler&
getNamespacesHandler() const
{
return m_namespacesHandler;
}
/**
* Retrieve the stylesheet from which this element comes
*
* @return reference to source stylesheet
*/
const Stylesheet&
getStylesheet() const
{
return m_stylesheet;
}
/**
* Set the flag indicating construction of the element is completed.
*
* @param fValue The value to set
*/
void
setFinishedConstruction(bool fValue)
{
setFlag(eFinishedConstruction, fValue);
}
/**
* Get the flag indicating construction of the element is completed.
*/
bool
getFinishedConstruction() const
{
return getFlag(eFinishedConstruction);
}
/**
* Called after construction is completed.
*/
virtual void
postConstruction(
StylesheetConstructionContext& constructionContext,
const NamespacesHandler& theParentHandler);
// Type-safe getters/setters...
/**
* Get the first child.
*
* @return first child node of this node
*/
virtual ElemTemplateElement*
getFirstChildElem() const;
#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
/**
* Method to initiate the execution of the element's children.
*
* @param executionContext context to execute this element
* @returns the first child element to execute
*/
virtual const ElemTemplateElement*
beginExecuteChildren(
StylesheetExecutionContext& executionContext) const;
/**
* Method to indicate the execution of the element's children
* is complete
*
* @param executionContext context to execute this element
*/
virtual void
endExecuteChildren(
StylesheetExecutionContext& executionContext) const;
/**
* Method to initiate output from the children
* to a string.
*
* @param executionContext context to execute this element
* @param result string to contain the final result
* @returns the first child element to execute
*/
const ElemTemplateElement*
beginChildrenToString(
StylesheetExecutionContext& executionContext,
XalanDOMString& result) const;
/**
* Method to indicate string output from the children is
* complete.
*
* @param executionContext context to execute this element
*/
void
endChildrenToString(
StylesheetExecutionContext& executionContext) const;
#endif
/**
* Set the first child.
*
* theChild - the new value for the first child.
*
* @return nothing
*/
virtual void
setFirstChildElem(ElemTemplateElement* theChild);
/**
* Get the last child.
*
* @return last child node of this node
*/
virtual ElemTemplateElement*
getLastChildElem() const;
/**
* Get the next sibling.
*
* @return next sibling node of this node
*/
virtual ElemTemplateElement*
getNextSiblingElem() const;
#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
/**
* Returns the next sub-element
*(i.e. children, attribute-sets, templates) to execute.
*
* @param executionContext context to execute element
* @param currentElem the last sub-element to be executed
* @returns next sub-element to execute, 0 only if no more sub-elements to execute
*/
virtual const ElemTemplateElement*
getNextChildElemToExecute(
StylesheetExecutionContext& executionContext,
const ElemTemplateElement* currentElem) const;
/**
* Returns the first sub-element
*(i.e. children, attribute-sets, templates) to execute.
*
* @param executionContext context to execute element
* @returns first sub-element to execute, 0 only if no sub-elements to execute
*/
virtual const ElemTemplateElement*
getFirstChildElemToExecute(
StylesheetExecutionContext& executionContext) const;
/**
* Filters sub-elements that should be executed
*
* @param executionContext context to execute element
* @param element the element to be executed
* @returns true if element should be executed, false otherwise
*/
virtual bool executeChildElement(
StylesheetExecutionContext& executionContext,
const ElemTemplateElement* element) const;
#endif
/**
* Set the next sibling.
*
* theSibling - the new value for the next sibling.
*
* @return nothing
*/
virtual void
setNextSiblingElem(ElemTemplateElement* theSibling);
/**
* Get the previous sibling.
*
* @return previous sibling node of this node
*/
virtual ElemTemplateElement*
getPreviousSiblingElem() const;
/**
* Set the previous sibling.
*
* theSibling - the new value for the previous sibling.
*
* @return nothing
*/
virtual void
setPreviousSiblingElem(ElemTemplateElement* theSibling);
/**
* Get the parent node.
*
* @return parent node of this node
*/
virtual ElemTemplateElement*
getParentNodeElem() const;
/**
* Set the parent node.
*
* theParent - the new value for the parent.
*
* @return nothing
*/
virtual void
setParentNodeElem(ElemTemplateElement* theParent);
/**
* Append a child.
*
* theParent - the new value for the parent.
*
* @return nothing
*/
virtual ElemTemplateElement*
appendChildElem(ElemTemplateElement* newChild);
/**
* Get XPath pattern/expression of one of the element atribute
*
* @index number of the attribute. If an attribute has more
* then one attribute with pattern/expression,the order of
* the returned expressions are undefined
*
* @return pointer or null
*/
virtual const XPath*
getXPath(XalanSize_t index) const;
// These interfaces are inherited from PrefixResolver...
virtual const XalanDOMString*
getNamespaceForPrefix(const XalanDOMString& prefix) const;
virtual const XalanDOMString&
getURI() const;
// A class that implements the XalanLocator
// abstract base class. ElemTemplateElement
// uses this class to provide locator information.
class LocatorProxy : public XalanLocator
{
public:
LocatorProxy(
XalanFileLoc theLineNumber,
XalanFileLoc theColumnNumber,
const XalanDOMString& theURI);
virtual
~LocatorProxy();
virtual const XMLCh*
getPublicId() const;
virtual const XMLCh*
getSystemId() const;
virtual XalanFileLoc
getLineNumber() const;
virtual XalanFileLoc
getColumnNumber() const;
const XalanDOMString&
getURI() const
{
return m_uri;
}
private:
// Not implemented...
LocatorProxy(const LocatorProxy&);
LocatorProxy&
operator=(const LocatorProxy&);
bool
operator==(const LocatorProxy&) const;
// data members...
const XalanFileLoc m_lineNumber;
const XalanFileLoc m_columnNumber;
const XalanDOMString& m_uri;
};
XalanFileLoc
getLineNumber() const
{
return m_locatorProxy.getLineNumber();
}
XalanFileLoc
getColumnNumber() const
{
return m_locatorProxy.getColumnNumber();
}
bool
hasParams() const
{
return getFlag(eHasParams);
}
bool
hasVariables() const
{
return getFlag(eHasVariables);
}
bool
hasSingleTextChild() const
{
return getFlag(eHasSingleTextChild);
}
bool
hasChildren() const
{
return m_firstChild != 0 ? true : false;
}
bool
hasDirectTemplate() const
{
return getFlag(eHasDirectTemplate);
}
bool
canGenerateAttributes() const
{
return getFlag(eCanGenerateAttributes);
}
bool
isDefaultTemplate() const
{
return getFlag(eDefaultTemplate);
}
protected:
void
canGenerateAttributes(bool value)
{
setFlag(eCanGenerateAttributes, value);
}
void
hasPrefix(bool value)
{
setFlag(eHasPrefix, value);
}
bool
hasPrefix() const
{
return getFlag(eHasPrefix);
}
void
preserveSpace(bool value)
{
setFlag(eSpacePreserve, value);
}
bool
preserveSpace() const
{
return getFlag(eSpacePreserve);
}
void
disableOutputEscaping(bool value)
{
setFlag(eDisableOutputEscaping, value);
}
bool
disableOutputEscaping() const
{
return getFlag(eDisableOutputEscaping);
}
/**
* Process the exclude-result-prefixes or the extension-element-prefixes
* attributes, for the purpose of prefix exclusion.
*
* @param constructionContext context when object consructed
* @param stylesheetTree The current Stylesheet object.
* @param localName The local name of the attribute.
* @param attrValue The value of the attribute.
*/
bool
processPrefixControl(
StylesheetConstructionContext& constructionContext,
const Stylesheet& stylesheetTree,
const XalanDOMString& localName,
const XalanDOMChar* attrValue);
/**
* Get the namespace for a given prefix.
*
* @param prefix The prefix to search for
* @param fExists If not null, set to true if the namespace was defined.
* @return The namespace string.
*/
const XalanDOMString*
getNamespaceForPrefixInternal(const XalanDOMString& prefix) const;
#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
/**
* Given an element, find the corresponding
* template.
*
* @param executionContext The current execution context
* @param xslInstruction The calling element
* @param template The template to use if xsl:for-each, or null.
* @param child The source context node.
* @returns matching template if any. Returns 0 if no matching template or corresponds to a default rule.
*/
virtual const ElemTemplateElement*
findTemplateToTransformChild(
StylesheetExecutionContext& executionContext,
const ElemTemplateElement& xslInstruction,
const ElemTemplateElement* theTemplate,
XalanNode* child) const;
/**
* Given an element, find the corresponding
* template.
*
* @param executionContext The current execution context
* @param xslInstruction The calling element
* @param template The template to use if xsl:for-each, or null.
* @param child The source context node.
* @param nodeType The type of child.
* @returns matching template if any. Returns 0 if no matching template or corresponds to a default rule.
*/
virtual const ElemTemplateElement*
findTemplateToTransformChild(
StylesheetExecutionContext& executionContext,
const ElemTemplateElement& xslInstruction,
const ElemTemplateElement* theTemplate,
XalanNode* child,
XalanNode::NodeType nodeType) const;
#else
/**
* Given an element, find the corresponding
* template and process the contents.
*
* @param executionContext The current execution context
* @param xslInstruction The calling element
* @param template The template to use if xsl:for-each, or null.
* @param child The source context node.
*/
virtual void
transformChild(
StylesheetExecutionContext& executionContext,
const ElemTemplateElement& xslInstruction,
const ElemTemplateElement* theTemplate,
XalanNode* child) const;
/**
* Given an element, find the corresponding
* template and process the contents.
*
* @param executionContext The current execution context
* @param xslInstruction The calling element
* @param template The template to use if xsl:for-each, or null.
* @param child The source context node.
* @param nodeType The type of child.
*/
virtual void
transformChild(
StylesheetExecutionContext& executionContext,
const ElemTemplateElement& xslInstruction,
const ElemTemplateElement* theTemplate,
XalanNode* child,
XalanNode::NodeType nodeType) const;
#endif
/**
* Given an xsl token type, determine whether or not a child
* of that type is allowed. This is so derived types can
* determine whether a particular type of child is allowed for
* the instance. It is called from appendChildElem().
*
* The default is to allow no types (no children)
*
* @param xslToken The xsl token value of the child.
*
* @return true if the child is allowed, or false if not.
*/
virtual bool
childTypeAllowed(int xslToken) const;
/**
* Called after construction is completed. This is a hook for
* deriving classes to handle post-construction with the
* instances HamespaceHandler instance, which is otherwise only
* available through a const accessor.
*/
virtual void
namespacesPostConstruction(
StylesheetConstructionContext& constructionContext,
const NamespacesHandler& theParentHandler,
NamespacesHandler& theHandler);
const NamespacesHandler&
getNamespaces() const
{
return m_namespacesHandler;
}
/**
* A convenience function for loading a message
* and reporting an error through the provided
* StylesheetExecutionContext instance.
*
* @param theContext The StylesheetExecutionContext to use
* @param theCode The code of the message
*/
void
error(
StylesheetExecutionContext& theContext,
XalanMessages::Codes theCode) const;
/**
* A convenience function for loading a message
* and reporting an error through the provided
* StylesheetExecutionContext instance.
*
* @param theContext The StylesheetExecutionContext to use
* @param theCode The code of the message
* @param theToken The substitution token for the message
*/
void
error(
StylesheetExecutionContext& theContext,
XalanMessages::Codes theCode,
const XalanDOMString& theToken) const;
/**
* A convenience function for loading a message
* and reporting an error through the provided
* StylesheetExecutionContext instance.
*
* @param theContext The StylesheetExecutionContext to use
* @param theCode The code of the message
* @param theLocator The Locator instance to use, if any
*/
void
error(
StylesheetExecutionContext& theContext,
XalanMessages::Codes theCode,
const Locator* theLocator) const;
/**
* A convenience function for loading a message
* and reporting a warning through the provided
* StylesheetExecutionContext instance.
*
* @param theContext The StylesheetExecutionContext to use
* @param theCode The code of the message
*/
void
warn(
StylesheetExecutionContext& theContext,
XalanMessages::Codes theCode) const;
/**
* A convenience function for loading a message
* and reporting a warning through the provided
* StylesheetExecutionContext instance.
*
* @param theContext The StylesheetExecutionContext to use
* @param theCode The code of the message
* @param theToken The substitution token for the message
*/
void
warn(
StylesheetExecutionContext& theContext,
XalanMessages::Codes theCode,
const XalanDOMString& theToken) const;
/**
* A convenience function for loading a message
* and reporting a warning through the provided
* StylesheetExecutionContext instance.
*
* @param theContext The StylesheetExecutionContext to use
* @param theCode The code of the message
* @param theLocator The Locator instance to use, if any
*/
void
warn(
StylesheetExecutionContext& theContext,
XalanMessages::Codes theCode,
const Locator* theLocator) const;
/**
* A convenience function for loading a message
* and reporting an error through the provided
* StylesheetConstructionContext instance.
*
* @param theContext The StylesheetConstructionContext to use
* @param theCode The code of the message
*/
void
error(
StylesheetConstructionContext& theContext,
XalanMessages::Codes theCode);
/**
* A convenience function for loading a message
* and reporting an error through the provided
* StylesheetConstructionContext instance.
*
* @param theContext The StylesheetConstructionContext to use
* @param theCode The code of the message
* @param theToken The substitution token for the message
* @param theLocator The Locator instance to use, if any
*/
void
error(
StylesheetConstructionContext& theContext,
XalanMessages::Codes theCode,
const XalanDOMString& theToken);
/**
* A convenience function for loading a message
* and reporting an error through the provided
* StylesheetConstructionContext instance.
*
* @param theContext The StylesheetConstructionContext to use
* @param theCode The code of the message
* @param theToken The substitution token for the message
* @param theLocator The Locator instance to use, if any
*/
void
error(
StylesheetConstructionContext& theContext,
XalanMessages::Codes theCode,
const XalanDOMString& theToken,
const Locator* theLocator);
/**
* A convenience function for loading a message
* and reporting an error through the provided
* StylesheetConstructionContext instance.
*
* @param theContext The StylesheetConstructionContext to use
* @param theCode The code of the message
* @param theToken1 The first substitution token for the message
* @param theToken2 The second substitution token for the message
*/
void
error(
StylesheetConstructionContext& theContext,
XalanMessages::Codes theCode,
const XalanDOMString& theToken1,
const XalanDOMString& theToken2);
/**
* A convenience function for loading a message
* and reporting an error through the provided
* StylesheetConstructionContext instance.
*
* @param theContext The StylesheetConstructionContext to use
* @param theCode The code of the message
* @param theToken1 The first substitution token for the message
* @param theToken2 The second substitution token for the message
*/
void
error(
StylesheetConstructionContext& theContext,
XalanMessages::Codes theCode,
const XalanDOMChar* theToken1,
const XalanDOMChar* theToken2);
/**
* A convenience function for loading a message
* and reporting an error through the provided
* StylesheetConstructionContext instance.
*
* @param theContext The StylesheetConstructionContext to use
* @param theCode The code of the message
* @param theToken1 The first substitution token for the message
* @param theToken2 The second substitution token for the message
* @param theToken3 The third substitution token for the message
*/
void
error(
StylesheetConstructionContext& theContext,
XalanMessages::Codes theCode,
const XalanDOMChar* theToken1,
const XalanDOMChar* theToken2,
const XalanDOMChar* theToken3);
/**
* A convenience function for loading a message
* and reporting a warning through the provided
* StylesheetConstructionContext instance.
*
* @param theContext The StylesheetConstructionContext to use
* @param theCode The code of the message
* @param theToken1 The first substitution token for the message
* @param theToken2 The second substitution token for the message
* @param theToken3 The third substitution token for the message
*/
void
warn(
StylesheetConstructionContext& theContext,
XalanMessages::Codes theCode,
const XalanDOMChar* theToken1,
const XalanDOMChar* theToken2,
const XalanDOMChar* theToken3);
// A handy empty XalanDOMString instance for
// derived classes to use.
static const XalanDOMString s_emptyString;
private:
enum eFlags
{
eHasParams = 1,
eHasSingleTextChild = 2,
eHasVariables = 4,
eHasDirectTemplate = 8,
eCanGenerateAttributes = 16,
eDefaultTemplate = 32,
eSpacePreserve = 64,
eFinishedConstruction = 128,
eHasPrefix = 256,
eDisableOutputEscaping = 512
};
bool
getFlag(eFlags theFlag) const
{
return m_flags & theFlag ? true : false;
}
void
setFlag(
eFlags theFlag,
bool theValue)
{
if (theValue == true)
{
m_flags |= theFlag;
}
else
{
m_flags &= ~theFlag;
}
}
#if defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
/**
* Take the contents of a template element, process it, and
* convert it to a string.
*
* @param executionContext The current execution context
* @param result result of executing the elements children
* @result a reference to a string containing the result.
*/
XalanDOMString&
doChildrenToString(
StylesheetExecutionContext& executionContext,
XalanDOMString& result) const;
#endif
Stylesheet& m_stylesheet;
/*
* This object handles all result tree namespace processing.
*/
NamespacesHandler m_namespacesHandler;
const int m_xslToken;
ElemTemplateElement* m_parentNode;
ElemTemplateElement* m_nextSibling;
ElemTemplateElement* m_previousSibling;
union
{
ElemTemplateElement* m_firstChild;
const ElemTemplate* m_directTemplate;
const ElemTextLiteral* m_textLiteralChild;
};
LocatorProxy m_locatorProxy;
unsigned short m_flags;
static const XalanQNameByReference s_emptyQName;
// Not implemented...
ElemTemplateElement(const ElemTemplateElement&);
ElemTemplateElement&
operator=(const ElemTemplateElement&);
bool
operator==(const ElemTemplateElement&) const;
};
XALAN_CPP_NAMESPACE_END
#endif // XALAN_ELEMTEMPLATEELEMENT_HEADER_GUARD
|