/usr/include/xalanc/XSLT/StylesheetRoot.hpp is in libxalan-c-dev 1.11-6.
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 | /*
* 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_STYLESHEETROOT_HEADER_GUARD)
#define XALAN_STYLESHEETROOT_HEADER_GUARD
// Base include file. Must be first.
#include "XSLTDefinitions.hpp"
#include "Stylesheet.hpp"
#include <xalanc/Include/XalanMap.hpp>
#include <xalanc/Include/STLHelper.hpp>
#include <xalanc/XalanDOM/XalanDOMString.hpp>
#include <xalanc/PlatformSupport/FormatterListener.hpp>
XALAN_CPP_NAMESPACE_BEGIN
class ElemAttributeSet;
class StylesheetConstructionContext;
class XalanText;
class XSLTResultTarget;
typedef XalanVector<ElemAttributeSet*> AttributeSetVectorTypeDecl;
XALAN_USES_MEMORY_MANAGER(AttributeSetVectorTypeDecl)
/**
* This acts as the stylesheet root of the stylesheet
* tree, and holds values that are shared by all
* stylesheets in the tree.
*/
class XALAN_XSLT_EXPORT StylesheetRoot : public Stylesheet
{
public:
typedef XalanVector<const XalanQName*> XalanQNameVectorType;
typedef AttributeSetVectorTypeDecl AttributeSetVectorType;
typedef XalanMap<const XalanQName*,
AttributeSetVectorType> AttributeSetMapType;
/**
* Construct a Stylesheet from a Document.
*
* @param baseIdentifier document identifier
* @param constructionContext context for construction of object
*/
StylesheetRoot(
const XalanDOMString& baseIdentifier,
StylesheetConstructionContext& constructionContext);
virtual
~StylesheetRoot();
static StylesheetRoot*
create(
MemoryManager& theManager,
const XalanDOMString& baseIdentifier,
StylesheetConstructionContext& constructionContext);
MemoryManager&
getMemoryManager()
{
return m_version.getMemoryManager();
}
/**
* Called after construction is completed.
*/
virtual void
postConstruction(StylesheetConstructionContext& constructionContext);
/**
* Transform the source tree to the output in the given result tree target.
*
* @param inputSource The input source
* @param outputTarget The output result target
* @param constructionContext context for construction of object
*/
void
process(
XalanNode* sourceTree,
XSLTResultTarget& outputTarget,
StylesheetExecutionContext& executionContext) const;
/**
* Have the stylesheet create the appropriate FormatterListener,
* based on the XSLTResultTarget provided. setupFormatterListener
* also calls setFormatterListener() on the execution context
* instance. setupFormatterListener() is done automatically by
* process(), but this is provided as an escape, to allow for
* changing the FormatterListener on-the-fly.
*
* @param outputTarget The output source tree
* @param constructionContext context for construction of object
* @return a pointer to the new FormatterListener instance.
*/
FormatterListener*
setupFormatterListener(
XSLTResultTarget& outputTarget,
StylesheetExecutionContext& executionContext) const;
/**
* Return the output method that was specified in the stylesheet.
* The returned value is one of FormatterLister::eFormat values.
*
* @return value of output method
*/
FormatterListener::eFormat
getOutputMethod() const
{
return m_outputMethod;
}
bool
isOutputMethodSet() const
{
return getOutputMethod() == FormatterListener::OUTPUT_METHOD_NONE ? false : true;
}
/**
* Get the output version string that was specified in the
* xsl:output element
*
* @return output version string
*/
XalanDOMString&
getOutputVersion(XalanDOMString& theResult) const
{
theResult.assign(m_version);
return theResult;
}
/**
* Determine if output indenting was specified in the
* xsl:output element
*
* @return true to indent
*/
bool
getOutputIndent() const
{
return m_indentResult == eIndentNoImplicit ||
m_indentResult == eIndentNoExplicit ? false : true;
}
/**
* Determine if output indenting should be
* enabled for HTML output. Semantically,
* this implies the output method is implicit,
* not explicit, but we don't really check that.
*
* @return true to indent
*/
bool
getHTMLOutputIndent() const
{
return m_indentResult == eIndentNoExplicit ? false : true;
}
/**
* Get the output encoding string that was specified in the
* xsl:output element
*
* @return encoding string
*/
XalanDOMString&
getOutputEncoding(XalanDOMString& theResult) const
{
theResult.assign(m_encoding);
return theResult;
}
/**
* Get the media-type string that was specified in the
* xsl:output element
*
* @return media type string
*/
XalanDOMString&
getOutputMediaType(XalanDOMString& theResult) const
{
theResult.assign(m_mediatype);
return theResult;
}
/**
* Get the doctype-system-id string that was specified in the
* xsl:output element
*
* @return document type string
*/
XalanDOMString &
getOutputDoctypeSystem(XalanDOMString& theResult) const
{
theResult.assign(m_doctypeSystem);
return theResult;
}
/**
* Get the doctype-public-id string that was specified in the
* xsl:output element
*
* @return document type public id string
*/
XalanDOMString&
getOutputDoctypePublic(XalanDOMString& theResult) const
{
theResult.assign(m_doctypePublic);
return theResult;
}
/**
* Determine whether to output XML declarations.
*
* @return true to output declarations
*/
bool
getOmitOutputXMLDecl() const
{
return m_omitxmlDecl;
}
/**
* Get the standalone string that was specified in the
* xsl:output element.(either "yes" or "no")
*
* @return standalone string
*/
XalanDOMString&
getOutputStandalone(XalanDOMString& theResult) const
{
theResult.assign(m_standalone);
return theResult;
}
/**
* Get the template representing the default rule for text.
*
* @return pointer to template rule for text
*/
ElemTemplateElement*
getDefaultTextRule() const
{
return m_defaultTextRule;
}
/**
* Get the template representing the default rule.
*
* @return pointer to default template rule
*/
ElemTemplateElement*
getDefaultRule() const
{
return m_defaultRule;
}
/**
* Get the template representing the default root rule.
*
* @return pointer to default root template rule
*/
ElemTemplateElement*
getDefaultRootRule() const
{
return m_defaultRootRule;
}
/**
* Process the "xsl:output" element.
*
* @param name name of element
* @param atts attribute list for element
* @param constructionContext context for construction of object
*/
void
processOutputSpec(
const XalanDOMChar* name,
const AttributeListType& atts,
StylesheetConstructionContext& constructionContext);
/**
* Retrieve the stack of imported stylesheets.
*
* @return stack of URIs for stylesheets
*/
URLStackType&
getImportStack()
{
return m_importStack;
}
/**
* Retrieve the stack of imported stylesheets.
*
* @return const stack of URIs for stylesheets
*/
const URLStackType&
getImportStack() const
{
return m_importStack;
}
/**
* Change the value of the flag for indenting results.
*
* @param bIndent true to indent results
*/
void
setIndentResult(bool bIndent)
{
m_indentResult = bIndent == true ? eIndentYesExplicit : eIndentNoExplicit;
}
/**
* Change the value of the output method, one of the
* FormatterListener::eFormat values.
*
* @param meth new method number
*/
void
setOutputMethod(FormatterListener::eFormat meth)
{
m_outputMethod = meth;
}
bool
hasCDATASectionElements() const
{
assert((m_hasCDATASectionElems == false && m_cdataSectionElems.empty() == true ) ||
( m_hasCDATASectionElems == true && m_cdataSectionElems.empty() == false));
return m_hasCDATASectionElems;
}
/**
* Determine if a QName is in the list of CDATA section
* element QNames.
*
* @param theQName The QName of the element to check.
* @return true or false
*/
bool
isCDATASectionElementName(const XalanQName& theQName) const;
/**
* Given a valid element key, return the corresponding node list.
*
* @param context context node
* @param qname qname of the key, which must match the 'name'
* attribute on xsl:key
* @param ref value that must match the value found by the
* 'match' attribute on xsl:key
* @param resolver resolver for namespace resolution
* @param nodelist A node list to contain the nodes found
* @param executionContext The current execution context
* @param theKeysTable The table of keys to search.
*/
void
getNodeSetByKey(
XalanNode* context,
const XalanQName& qname,
const XalanDOMString& ref,
const PrefixResolver& resolver,
MutableNodeRefList& nodelist,
StylesheetExecutionContext& executionContext,
const Locator* locator,
KeyTablesTableType& theKeysTable) const;
unsigned long
getNextElemNumberID()
{
return m_elemNumberNextID++;
}
unsigned long
getElemNumberCount() const
{
return m_elemNumberNextID;
}
bool
hasPreserveOrStripSpaceElements() const
{
return m_hasStripOrPreserveSpace;
}
/**
* Check to see if a whitespace text node should be stripped from
* the source tree.
*
* @param theNode The text node to check.
*/
bool
shouldStripSourceNode(const XalanText& theNode) const
{
if (hasPreserveOrStripSpaceElements() == true &&
theNode.isWhitespace() == true)
{
return internalShouldStripSourceNode(theNode);
}
return false;
}
void
addAttributeSet(ElemAttributeSet& theAttributeSet);
#if !defined(XALAN_RECURSIVE_STYLESHEET_EXECUTION)
/**
* Get the nth attribute set with the specified name.
*
* @param execution context for executing this stylesheet
* @param theQName the name of the attribute set
* @param matchingIndex index of the attribute set with the specified name
* @param theLocator the locator
* @returns a pointer to the attribute, 0 if no matching attribute set
*/
const ElemAttributeSet*
getAttributeSet(
StylesheetExecutionContext& theExecutionContext,
const XalanQName& theQName,
size_type matchingIndex,
const Locator* theLocator) const;
#else
void
executeAttributeSet(
StylesheetExecutionContext& theExecutionContext,
const XalanQName& theQName,
const Locator* theLocator) const;
#endif
private:
/**
* Choose the encoding to use.
*
* @param outputTarget The output result target
*
* @return The chosen encoding
*/
const XalanDOMString&
getEncoding(const XSLTResultTarget& outputTarget) const;
/**
* Create the default rule if needed.
*
* @param constructionContext context for construction of object
*/
void
initDefaultRule(StylesheetConstructionContext& constructionContext);
/**
* Check to see if a whitespace text node should be stripped from
* the source tree.
*
* @param theNode The text node to check.
*/
bool
internalShouldStripSourceNode(const XalanText& theNode) const;
/**
* The version tells the version of XML to be used for outputting the result tree,
* as specified in xsl:output.
*/
XalanDOMString m_version;
enum eIndentType { eIndentNoImplicit, eIndentNoExplicit, eIndentYesImplicit, eIndentYesExplicit };
/**
* indent-result is by default no, which means an XSL processor must not
* change the whitespace on output.
*/
eIndentType m_indentResult;
/**
* The encoding attribute specifies the preferred encoding to use
* for outputting the result tree.
*/
XalanDOMString m_encoding;
/**
* The media-type attribute is applicable for the xml output method.
* The default value for the media-type attribute is text/xml.
*/
XalanDOMString m_mediatype;
/**
* If the doctype-system-id attribute is specified, the xml output method should
* output a document type declaration immediately before the first element.
* The name following <!DOCTYPE should be the name of the first element.
*/
XalanDOMString m_doctypeSystem;
/**
* If doctype-public-id attribute is also specified, then the xml output
* method should output PUBLIC followed by the public identifier and then
* the system identifier; otherwise, it should output SYSTEM followed by
* the system identifier. The internal subset should be empty. The
* doctype-public-id attribute should be ignored unless the doctype-system-id
* attribute is specified.
*/
XalanDOMString m_doctypePublic;
/**
* Tells whether or not to output an XML declaration.
*/
bool m_omitxmlDecl;
/**
* Tells what the xmldecl should specify for the standalone value.
*/
XalanDOMString m_standalone;
/**
* The URL that belongs to the result namespace.
* @serial
*/
XalanDOMString m_resultNameSpaceURL;
/**
* The output method as specified in xsl:output.
*/
FormatterListener::eFormat m_outputMethod;
/**
* Vector of qnames that specifies elements that should be formatted
* as CDATA.
*/
XalanQNameVectorType m_cdataSectionElems;
bool m_hasCDATASectionElems;
/**
* A stack of who's importing whom is needed in order to detect
* a recursive include or import, which is an error.
*/
URLStackType m_importStack;
/**
* The default template to use for text nodes if we don't find
* anything else. This is initialized in initDefaultRule().
*/
ElemTemplateElement* m_defaultTextRule;
/**
* The default template to use if we don't find anything
* else. This is initialized in initDefaultRule().
*/
ElemTemplateElement* m_defaultRule;
/**
* The default template to use for the root if we don't find
* anything else. This is initialized in initDefaultRule().
*/
ElemTemplateElement* m_defaultRootRule;
/**
* This is set to true if an xsl:key directive is found.
*/
bool m_needToBuildKeysTable;
/**
* This is set to true if URLs should be escaped in HTML output (the default)
*/
bool m_outputEscapeURLs;
/**
* The amount to indent. The default is -1, which indicates not to indent.
*/
int m_indentAmount;
/**
* This is set to true if we should omit the META tag in HTML output (the default is false)
*/
bool m_omitMETATag;
/**
* This is set to true if we should omit the META tag in HTML output (the default is false)
*/
unsigned long m_elemNumberNextID;
/**
* A lookup table of all attribute sets.
*/
AttributeSetMapType m_attributeSetsMap;
/**
* true if there are any whitespace strip or preserve
* elements.
*/
bool m_hasStripOrPreserveSpace;
// Not implemented...
StylesheetRoot(const StylesheetRoot&);
StylesheetRoot&
operator=(const StylesheetRoot&);
bool
operator==(const StylesheetRoot&) const;
};
XALAN_CPP_NAMESPACE_END
#endif // XALAN_STYLESHEETROOT_HEADER_GUARD
|