1. /*
  2. * The Apache Software License, Version 1.1
  3. *
  4. *
  5. * Copyright (c) 1999 The Apache Software Foundation. All rights
  6. * reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. *
  20. * 3. The end-user documentation included with the redistribution,
  21. * if any, must include the following acknowledgment:
  22. * "This product includes software developed by the
  23. * Apache Software Foundation (http://www.apache.org/)."
  24. * Alternately, this acknowledgment may appear in the software itself,
  25. * if and wherever such third-party acknowledgments normally appear.
  26. *
  27. * 4. The names "Xalan" and "Apache Software Foundation" must
  28. * not be used to endorse or promote products derived from this
  29. * software without prior written permission. For written
  30. * permission, please contact apache@apache.org.
  31. *
  32. * 5. Products derived from this software may not be called "Apache",
  33. * nor may "Apache" appear in their name, without prior written
  34. * permission of the Apache Software Foundation.
  35. *
  36. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  37. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  38. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  40. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  43. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  44. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  45. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  46. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  47. * SUCH DAMAGE.
  48. * ====================================================================
  49. *
  50. * This software consists of voluntary contributions made by many
  51. * individuals on behalf of the Apache Software Foundation and was
  52. * originally based on software copyright (c) 1999, Lotus
  53. * Development Corporation., http://www.lotus.com. For more
  54. * information on the Apache Software Foundation, please see
  55. * <http://www.apache.org/>.
  56. */
  57. package org.apache.xalan.templates;
  58. // Java imports
  59. import java.io.ObjectInputStream;
  60. import java.io.IOException;
  61. import java.io.ObjectOutputStream;
  62. import java.text.DecimalFormatSymbols;
  63. import java.util.Hashtable;
  64. import java.util.Stack;
  65. import java.util.Vector;
  66. // Xalan imports
  67. import org.apache.xml.utils.SystemIDResolver;
  68. import org.apache.xml.utils.QName;
  69. import org.apache.xml.utils.StringVector;
  70. import org.apache.xpath.XPath;
  71. // DOM Imports
  72. //import org.w3c.dom.Node;
  73. //import org.w3c.dom.Document;
  74. import org.apache.xml.dtm.DTM;
  75. // SAX2 Imports
  76. import javax.xml.transform.TransformerException;
  77. import org.xml.sax.Locator;
  78. import javax.xml.transform.SourceLocator;
  79. /**
  80. * Represents a stylesheet element.
  81. * <p>All properties in this class have a fixed form of bean-style property
  82. * accessors for all properties that represent XSL attributes or elements.
  83. * These properties have setter method names accessed generically by the
  84. * processor, and so these names must be fixed according to the system
  85. * defined in the <a href="XSLTAttributeDef#getSetterMethodName">getSetterMethodName</a>
  86. * function.</p>
  87. * <p><pre>
  88. * <!ENTITY % top-level "
  89. * (xsl:import*,
  90. * (xsl:include
  91. * | xsl:strip-space
  92. * | xsl:preserve-space
  93. * | xsl:output
  94. * | xsl:key
  95. * | xsl:decimal-format
  96. * | xsl:attribute-set
  97. * | xsl:variable
  98. * | xsl:param
  99. * | xsl:template
  100. * | xsl:namespace-alias
  101. * %non-xsl-top-level;)*)
  102. * ">
  103. *
  104. * <!ENTITY % top-level-atts '
  105. * extension-element-prefixes CDATA #IMPLIED
  106. * exclude-result-prefixes CDATA #IMPLIED
  107. * id ID #IMPLIED
  108. * version NMTOKEN #REQUIRED
  109. * xmlns:xsl CDATA #FIXED "http://www.w3.org/1999/XSL/Transform"
  110. * %space-att;
  111. * '>
  112. *
  113. * <!ELEMENT xsl:stylesheet %top-level;>
  114. * <!ATTLIST xsl:stylesheet %top-level-atts;>
  115. *
  116. * <!ELEMENT xsl:transform %top-level;>
  117. * <!ATTLIST xsl:transform %top-level-atts;>
  118. *
  119. * </p></pre>
  120. * @see <a href="http://www.w3.org/TR/xslt#section-Stylesheet-Structure">section-Stylesheet-Structure in XSLT Specification</a>
  121. */
  122. public class Stylesheet extends ElemTemplateElement
  123. implements java.io.Serializable /* , Document */
  124. {
  125. /**
  126. * Constructor for a Stylesheet.
  127. * @param parent The including or importing stylesheet.
  128. */
  129. public Stylesheet(Stylesheet parent)
  130. {
  131. if (null != parent)
  132. {
  133. m_stylesheetParent = parent;
  134. m_stylesheetRoot = parent.getStylesheetRoot();
  135. }
  136. }
  137. /**
  138. * Get the owning stylesheet. This looks up the
  139. * inheritance chain until it calls getStylesheet
  140. * on a Stylesheet object, which will return itself.
  141. *
  142. * @return The owning stylesheet, itself.
  143. */
  144. public Stylesheet getStylesheet()
  145. {
  146. return this;
  147. }
  148. /**
  149. * Tell if this can be cast to a StylesheetComposed, meaning, you
  150. * can ask questions from getXXXComposed functions.
  151. *
  152. * @return False if this is not a StylesheetComposed
  153. */
  154. public boolean isAggregatedType()
  155. {
  156. return false;
  157. }
  158. /**
  159. * Tell if this is the root of the stylesheet tree.
  160. *
  161. * @return False is this is not the root of the stylesheet tree.
  162. */
  163. public boolean isRoot()
  164. {
  165. return false;
  166. }
  167. /**
  168. * Extension to be used when serializing to disk.
  169. */
  170. public static final String STYLESHEET_EXT = ".lxc";
  171. /**
  172. * Read the stylesheet from a serialization stream.
  173. *
  174. * @param stream Input stream to read from
  175. *
  176. * @throws IOException
  177. * @throws TransformerException
  178. */
  179. private void readObject(ObjectInputStream stream)
  180. throws IOException, TransformerException
  181. {
  182. // System.out.println("Reading Stylesheet");
  183. try
  184. {
  185. stream.defaultReadObject();
  186. }
  187. catch (ClassNotFoundException cnfe)
  188. {
  189. throw new TransformerException(cnfe);
  190. }
  191. // System.out.println("Done reading Stylesheet");
  192. }
  193. /**
  194. * Write out the given output stream
  195. *
  196. *
  197. * @param stream The output stream to write out
  198. *
  199. * @throws IOException
  200. */
  201. private void writeObject(ObjectOutputStream stream) throws IOException
  202. {
  203. // System.out.println("Writing Stylesheet");
  204. stream.defaultWriteObject();
  205. // System.out.println("Done writing Stylesheet");
  206. }
  207. //============== XSLT Properties =================
  208. /**
  209. * The "xmlns:xsl" property.
  210. * @serial
  211. */
  212. private String m_XmlnsXsl;
  213. /**
  214. * Set the "xmlns:xsl" property.
  215. * @see <a href="http://www.w3.org/TR/xslt#xslt-namespace">xslt-namespace in XSLT Specification</a>
  216. *
  217. * @param v The value to be set for the "xmlns:xsl" property.
  218. */
  219. public void setXmlnsXsl(String v)
  220. {
  221. m_XmlnsXsl = v;
  222. }
  223. /**
  224. * Get the "xmlns:xsl" property.
  225. * @see <a href="http://www.w3.org/TR/xslt#xslt-namespace">xslt-namespace in XSLT Specification</a>
  226. *
  227. * @return The value of the "xmlns:xsl" property.
  228. */
  229. public String getXmlnsXsl()
  230. {
  231. return m_XmlnsXsl;
  232. }
  233. /**
  234. * The "extension-element-prefixes" property, actually contains URIs.
  235. * @serial
  236. */
  237. private StringVector m_ExtensionElementURIs;
  238. /**
  239. * Set the "extension-element-prefixes" property.
  240. * @see <a href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT Specification</a>
  241. *
  242. * @param v The value to be set for the "extension-element-prefixes"
  243. * property: a vector of extension element URIs.
  244. */
  245. public void setExtensionElementPrefixes(StringVector v)
  246. {
  247. m_ExtensionElementURIs = v;
  248. }
  249. /**
  250. * Get and "extension-element-prefix" property.
  251. * @see <a href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT Specification</a>
  252. *
  253. * @param i Index of extension element URI in list
  254. *
  255. * @return The extension element URI at the given index
  256. *
  257. * @throws ArrayIndexOutOfBoundsException
  258. */
  259. public String getExtensionElementPrefix(int i)
  260. throws ArrayIndexOutOfBoundsException
  261. {
  262. if (null == m_ExtensionElementURIs)
  263. throw new ArrayIndexOutOfBoundsException();
  264. return m_ExtensionElementURIs.elementAt(i);
  265. }
  266. /**
  267. * Get the number of "extension-element-prefixes" Strings.
  268. * @see <a href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT Specification</a>
  269. *
  270. * @return Number of URIs in the list
  271. */
  272. public int getExtensionElementPrefixCount()
  273. {
  274. return (null != m_ExtensionElementURIs)
  275. ? m_ExtensionElementURIs.size() : 0;
  276. }
  277. /**
  278. * Find out if this contains a given "extension-element-prefix" property.
  279. * @see <a href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT Specification</a>
  280. *
  281. * @param uri URI of extension element to look for
  282. *
  283. * @return True if the given URI was found in the list
  284. */
  285. public boolean containsExtensionElementURI(String uri)
  286. {
  287. if (null == m_ExtensionElementURIs)
  288. return false;
  289. return m_ExtensionElementURIs.contains(uri);
  290. }
  291. /**
  292. * The "exclude-result-prefixes" property.
  293. * @serial
  294. */
  295. private StringVector m_ExcludeResultPrefixs;
  296. /**
  297. * Set the "exclude-result-prefixes" property.
  298. * The designation of a namespace as an excluded namespace is
  299. * effective within the subtree of the stylesheet rooted at
  300. * the element bearing the exclude-result-prefixes or
  301. * xsl:exclude-result-prefixes attribute; a subtree rooted
  302. * at an xsl:stylesheet element does not include any stylesheets
  303. * imported or included by children of that xsl:stylesheet element.
  304. * @see <a href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element in XSLT Specification</a>
  305. *
  306. * @param v A StringVector of prefixes to exclude
  307. */
  308. public void setExcludeResultPrefixes(StringVector v)
  309. {
  310. m_ExcludeResultPrefixs = v;
  311. }
  312. /**
  313. * Get an "exclude-result-prefix" property.
  314. * The designation of a namespace as an excluded namespace is
  315. * effective within the subtree of the stylesheet rooted at
  316. * the element bearing the exclude-result-prefixes or
  317. * xsl:exclude-result-prefixes attribute; a subtree rooted
  318. * at an xsl:stylesheet element does not include any stylesheets
  319. * imported or included by children of that xsl:stylesheet element.
  320. * @see <a href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element in XSLT Specification</a>
  321. *
  322. * @param i Index of prefix to get in list
  323. *
  324. * @return Prefix to be excluded at the given index
  325. *
  326. * @throws ArrayIndexOutOfBoundsException
  327. */
  328. public String getExcludeResultPrefix(int i)
  329. throws ArrayIndexOutOfBoundsException
  330. {
  331. if (null == m_ExcludeResultPrefixs)
  332. throw new ArrayIndexOutOfBoundsException();
  333. return m_ExcludeResultPrefixs.elementAt(i);
  334. }
  335. /**
  336. * Get the number of "exclude-result-prefixes" Strings.
  337. * @see <a href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element in XSLT Specification</a>
  338. *
  339. * @return The number of prefix strings to be excluded.
  340. */
  341. public int getExcludeResultPrefixCount()
  342. {
  343. return (null != m_ExcludeResultPrefixs)
  344. ? m_ExcludeResultPrefixs.size() : 0;
  345. }
  346. /**
  347. * Get whether or not the passed prefix is contained flagged by
  348. * the "exclude-result-prefixes" property.
  349. * @see <a href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element in XSLT Specification</a>
  350. *
  351. * @param prefix non-null reference to prefix that might be excluded.
  352. * @param uri reference to namespace that prefix maps to
  353. *
  354. * @return true if the prefix should normally be excluded.>
  355. */
  356. public boolean containsExcludeResultPrefix(String prefix, String uri)
  357. {
  358. if (null == m_ExcludeResultPrefixs || uri == null )
  359. return false;
  360. // This loop is ok here because this code only runs during
  361. // stylesheet compile time.
  362. for (int i =0; i< m_ExcludeResultPrefixs.size(); i++)
  363. {
  364. if (uri.equals(getNamespaceForPrefix(m_ExcludeResultPrefixs.elementAt(i))))
  365. return true;
  366. }
  367. return false;
  368. /* if (prefix.length() == 0)
  369. prefix = Constants.ATTRVAL_DEFAULT_PREFIX;
  370. return m_ExcludeResultPrefixs.contains(prefix); */
  371. }
  372. /**
  373. * The "id" property.
  374. * @serial
  375. */
  376. private String m_Id;
  377. /**
  378. * Set the "id" property.
  379. * @see <a href="http://www.w3.org/TR/xslt#section-Embedding-Stylesheets">section-Embedding-Stylesheets in XSLT Specification</a>
  380. *
  381. * @param v Value for the "id" property.
  382. */
  383. public void setId(String v)
  384. {
  385. m_Id = v;
  386. }
  387. /**
  388. * Get the "id" property.
  389. * @see <a href="http://www.w3.org/TR/xslt#section-Embedding-Stylesheets">section-Embedding-Stylesheets in XSLT Specification</a>
  390. *
  391. * @return The value of the "id" property.
  392. */
  393. public String getId()
  394. {
  395. return m_Id;
  396. }
  397. /**
  398. * The "version" property.
  399. * @serial
  400. */
  401. private String m_Version;
  402. /**
  403. * Set the "version" property.
  404. * @see <a href="http://www.w3.org/TR/xslt#forwards">forwards in XSLT Specification</a>
  405. *
  406. * @param v Value for the "version" property.
  407. */
  408. public void setVersion(String v)
  409. {
  410. m_Version = v;
  411. }
  412. /**
  413. * Get the "version" property.
  414. * @see <a href="http://www.w3.org/TR/xslt#forwards">forwards in XSLT Specification</a>
  415. *
  416. * @return The value of the "version" property.
  417. */
  418. public String getVersion()
  419. {
  420. return m_Version;
  421. }
  422. /**
  423. * The "xsl:import" list.
  424. * @serial
  425. */
  426. private Vector m_imports;
  427. /**
  428. * Add a stylesheet to the "import" list.
  429. * @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT Specification</a>
  430. *
  431. * @param v Stylesheet to add to the import list
  432. */
  433. public void setImport(StylesheetComposed v)
  434. {
  435. if (null == m_imports)
  436. m_imports = new Vector();
  437. // I'm going to insert the elements in backwards order,
  438. // so I can walk them 0 to n.
  439. m_imports.addElement(v);
  440. }
  441. /**
  442. * Get a stylesheet from the "import" list.
  443. * @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT Specification</a>
  444. *
  445. * @param i Index of the stylesheet to get
  446. *
  447. * @return The stylesheet at the given index
  448. *
  449. * @throws ArrayIndexOutOfBoundsException
  450. */
  451. public StylesheetComposed getImport(int i)
  452. throws ArrayIndexOutOfBoundsException
  453. {
  454. if (null == m_imports)
  455. throw new ArrayIndexOutOfBoundsException();
  456. return (StylesheetComposed) m_imports.elementAt(i);
  457. }
  458. /**
  459. * Get the number of imported stylesheets.
  460. * @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT Specification</a>
  461. *
  462. * @return the number of imported stylesheets.
  463. */
  464. public int getImportCount()
  465. {
  466. return (null != m_imports) ? m_imports.size() : 0;
  467. }
  468. /**
  469. * The "xsl:include" properties.
  470. * @serial
  471. */
  472. private Vector m_includes;
  473. /**
  474. * Add a stylesheet to the "include" list.
  475. * @see <a href="http://www.w3.org/TR/xslt#include">include in XSLT Specification</a>
  476. *
  477. * @param v Stylesheet to add to the "include" list
  478. */
  479. public void setInclude(Stylesheet v)
  480. {
  481. if (null == m_includes)
  482. m_includes = new Vector();
  483. m_includes.addElement(v);
  484. }
  485. /**
  486. * Get the stylesheet at the given in index in "include" list
  487. * @see <a href="http://www.w3.org/TR/xslt#include">include in XSLT Specification</a>
  488. *
  489. * @param i Index of stylesheet to get
  490. *
  491. * @return Stylesheet at the given index
  492. *
  493. * @throws ArrayIndexOutOfBoundsException
  494. */
  495. public Stylesheet getInclude(int i) throws ArrayIndexOutOfBoundsException
  496. {
  497. if (null == m_includes)
  498. throw new ArrayIndexOutOfBoundsException();
  499. return (Stylesheet) m_includes.elementAt(i);
  500. }
  501. /**
  502. * Get the number of included stylesheets.
  503. * @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT Specification</a>
  504. *
  505. * @return the number of included stylesheets.
  506. */
  507. public int getIncludeCount()
  508. {
  509. return (null != m_includes) ? m_includes.size() : 0;
  510. }
  511. /**
  512. * Table of tables of element decimal-format.
  513. * @see DecimalFormatProperties
  514. * @serial
  515. */
  516. Stack m_DecimalFormatDeclarations;
  517. /**
  518. * Process the xsl:decimal-format element.
  519. *
  520. * @param edf Decimal-format element to push into stack
  521. */
  522. public void setDecimalFormat(DecimalFormatProperties edf)
  523. {
  524. if (null == m_DecimalFormatDeclarations)
  525. m_DecimalFormatDeclarations = new Stack();
  526. // Elements are pushed in by order of importance
  527. // so that when recomposed, they get overiden properly.
  528. m_DecimalFormatDeclarations.push(edf);
  529. }
  530. /**
  531. * Get an "xsl:decimal-format" property.
  532. *
  533. * @see DecimalFormatProperties
  534. * @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in XSLT Specification</a>
  535. *
  536. * @param name The qualified name of the decimal format property.
  537. * @return null if not found, otherwise a DecimalFormatProperties
  538. * object, from which you can get a DecimalFormatSymbols object.
  539. */
  540. public DecimalFormatProperties getDecimalFormat(QName name)
  541. {
  542. if (null == m_DecimalFormatDeclarations)
  543. return null;
  544. int n = getDecimalFormatCount();
  545. for (int i = (n - 1); i >= 0; i++)
  546. {
  547. DecimalFormatProperties dfp = getDecimalFormat(i);
  548. if (dfp.getName().equals(name))
  549. return dfp;
  550. }
  551. return null;
  552. }
  553. /**
  554. * Get an "xsl:decimal-format" property.
  555. * @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in XSLT Specification</a>
  556. * @see DecimalFormatProperties
  557. *
  558. * @param i Index of decimal-format property in stack
  559. *
  560. * @return The decimal-format property at the given index
  561. *
  562. * @throws ArrayIndexOutOfBoundsException
  563. */
  564. public DecimalFormatProperties getDecimalFormat(int i)
  565. throws ArrayIndexOutOfBoundsException
  566. {
  567. if (null == m_DecimalFormatDeclarations)
  568. throw new ArrayIndexOutOfBoundsException();
  569. return (DecimalFormatProperties) m_DecimalFormatDeclarations.elementAt(i);
  570. }
  571. /**
  572. * Get the number of xsl:decimal-format declarations.
  573. * @see DecimalFormatProperties
  574. *
  575. * @return the number of xsl:decimal-format declarations.
  576. */
  577. public int getDecimalFormatCount()
  578. {
  579. return (null != m_DecimalFormatDeclarations)
  580. ? m_DecimalFormatDeclarations.size() : 0;
  581. }
  582. /**
  583. * The "xsl:strip-space" properties,
  584. * A lookup table of all space stripping elements.
  585. * @serial
  586. */
  587. private Vector m_whitespaceStrippingElements;
  588. /**
  589. * Set the "xsl:strip-space" properties.
  590. * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>
  591. *
  592. * @param wsi WhiteSpaceInfo element to add to list
  593. */
  594. public void setStripSpaces(WhiteSpaceInfo wsi)
  595. {
  596. if (null == m_whitespaceStrippingElements)
  597. {
  598. m_whitespaceStrippingElements = new Vector();
  599. }
  600. m_whitespaceStrippingElements.addElement(wsi);
  601. }
  602. /**
  603. * Get an "xsl:strip-space" property.
  604. * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>
  605. *
  606. * @param i Index of WhiteSpaceInfo to get
  607. *
  608. * @return WhiteSpaceInfo at given index
  609. *
  610. * @throws ArrayIndexOutOfBoundsException
  611. */
  612. public WhiteSpaceInfo getStripSpace(int i) throws ArrayIndexOutOfBoundsException
  613. {
  614. if (null == m_whitespaceStrippingElements)
  615. throw new ArrayIndexOutOfBoundsException();
  616. return (WhiteSpaceInfo) m_whitespaceStrippingElements.elementAt(i);
  617. }
  618. /**
  619. * Get the number of "xsl:strip-space" properties.
  620. * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>
  621. *
  622. * @return the number of "xsl:strip-space" properties.
  623. */
  624. public int getStripSpaceCount()
  625. {
  626. return (null != m_whitespaceStrippingElements)
  627. ? m_whitespaceStrippingElements.size() : 0;
  628. }
  629. /**
  630. * The "xsl:preserve-space" property,
  631. * A lookup table of all space preserving elements.
  632. * @serial
  633. */
  634. private Vector m_whitespacePreservingElements;
  635. /**
  636. * Set the "xsl:preserve-space" property.
  637. * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>
  638. *
  639. * @param wsi WhiteSpaceInfo element to add to list
  640. */
  641. public void setPreserveSpaces(WhiteSpaceInfo wsi)
  642. {
  643. if (null == m_whitespacePreservingElements)
  644. {
  645. m_whitespacePreservingElements = new Vector();
  646. }
  647. m_whitespacePreservingElements.addElement(wsi);
  648. }
  649. /**
  650. * Get a "xsl:preserve-space" property.
  651. * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>
  652. *
  653. * @param i Index of WhiteSpaceInfo to get
  654. *
  655. * @return WhiteSpaceInfo at the given index
  656. *
  657. * @throws ArrayIndexOutOfBoundsException
  658. */
  659. public WhiteSpaceInfo getPreserveSpace(int i) throws ArrayIndexOutOfBoundsException
  660. {
  661. if (null == m_whitespacePreservingElements)
  662. throw new ArrayIndexOutOfBoundsException();
  663. return (WhiteSpaceInfo) m_whitespacePreservingElements.elementAt(i);
  664. }
  665. /**
  666. * Get the number of "xsl:preserve-space" properties.
  667. * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>
  668. *
  669. * @return the number of "xsl:preserve-space" properties.
  670. */
  671. public int getPreserveSpaceCount()
  672. {
  673. return (null != m_whitespacePreservingElements)
  674. ? m_whitespacePreservingElements.size() : 0;
  675. }
  676. /**
  677. * The "xsl:output" properties. This is a vector of OutputProperties objects.
  678. * @serial
  679. */
  680. private Vector m_output;
  681. /**
  682. * Set the "xsl:output" property.
  683. * @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT Specification</a>
  684. *
  685. * @param v non-null reference to the OutputProperties object to be
  686. * added to the collection.
  687. */
  688. public void setOutput(OutputProperties v)
  689. {
  690. if (null == m_output)
  691. {
  692. m_output = new Vector();
  693. }
  694. m_output.addElement(v);
  695. }
  696. /**
  697. * Get an "xsl:output" property.
  698. * @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT Specification</a>
  699. *
  700. * @param i Index of OutputFormatExtended to get
  701. *
  702. * @return non-null reference to an OutputProperties object.
  703. *
  704. * @throws ArrayIndexOutOfBoundsException
  705. */
  706. public OutputProperties getOutput(int i) throws ArrayIndexOutOfBoundsException
  707. {
  708. if (null == m_output)
  709. throw new ArrayIndexOutOfBoundsException();
  710. return (OutputProperties) m_output.elementAt(i);
  711. }
  712. /**
  713. * Get the number of "xsl:output" properties.
  714. * @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT Specification</a>
  715. *
  716. * @return The number of OutputProperties objects contained in this stylesheet.
  717. */
  718. public int getOutputCount()
  719. {
  720. return (null != m_output)
  721. ? m_output.size() : 0;
  722. }
  723. /**
  724. * The "xsl:key" property.
  725. * @serial
  726. */
  727. private Vector m_keyDeclarations;
  728. /**
  729. * Set the "xsl:key" property.
  730. * @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT Specification</a>
  731. *
  732. * @param v KeyDeclaration element to add to the list of key declarations
  733. */
  734. public void setKey(KeyDeclaration v)
  735. {
  736. if (null == m_keyDeclarations)
  737. m_keyDeclarations = new Vector();
  738. m_keyDeclarations.addElement(v);
  739. }
  740. /**
  741. * Get an "xsl:key" property.
  742. * @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT Specification</a>
  743. *
  744. * @param i Index of KeyDeclaration element to get
  745. *
  746. * @return KeyDeclaration element at given index in list
  747. *
  748. * @throws ArrayIndexOutOfBoundsException
  749. */
  750. public KeyDeclaration getKey(int i) throws ArrayIndexOutOfBoundsException
  751. {
  752. if (null == m_keyDeclarations)
  753. throw new ArrayIndexOutOfBoundsException();
  754. return (KeyDeclaration) m_keyDeclarations.elementAt(i);
  755. }
  756. /**
  757. * Get the number of "xsl:key" properties.
  758. * @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT Specification</a>
  759. *
  760. * @return the number of "xsl:key" properties.
  761. */
  762. public int getKeyCount()
  763. {
  764. return (null != m_keyDeclarations) ? m_keyDeclarations.size() : 0;
  765. }
  766. /**
  767. * The "xsl:attribute-set" property.
  768. * @serial
  769. */
  770. private Vector m_attributeSets;
  771. /**
  772. * Set the "xsl:attribute-set" property.
  773. * @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets in XSLT Specification</a>
  774. *
  775. * @param attrSet ElemAttributeSet to add to the list of attribute sets
  776. */
  777. public void setAttributeSet(ElemAttributeSet attrSet)
  778. {
  779. if (null == m_attributeSets)
  780. {
  781. m_attributeSets = new Vector();
  782. }
  783. m_attributeSets.addElement(attrSet);
  784. }
  785. /**
  786. * Get an "xsl:attribute-set" property.
  787. * @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets in XSLT Specification</a>
  788. *
  789. * @param i Index of ElemAttributeSet to get in list
  790. *
  791. * @return ElemAttributeSet at the given index
  792. *
  793. * @throws ArrayIndexOutOfBoundsException
  794. */
  795. public ElemAttributeSet getAttributeSet(int i)
  796. throws ArrayIndexOutOfBoundsException
  797. {
  798. if (null == m_attributeSets)
  799. throw new ArrayIndexOutOfBoundsException();
  800. return (ElemAttributeSet) m_attributeSets.elementAt(i);
  801. }
  802. /**
  803. * Get the number of "xsl:attribute-set" properties.
  804. * @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets in XSLT Specification</a>
  805. *
  806. * @return the number of "xsl:attribute-set" properties.
  807. */
  808. public int getAttributeSetCount()
  809. {
  810. return (null != m_attributeSets) ? m_attributeSets.size() : 0;
  811. }
  812. /**
  813. * The "xsl:variable" and "xsl:param" properties.
  814. * @serial
  815. */
  816. private Vector m_topLevelVariables;
  817. /**
  818. * Set the "xsl:variable" property.
  819. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
  820. *
  821. * @param v ElemVariable object to add to list of top level variables
  822. */
  823. public void setVariable(ElemVariable v)
  824. {
  825. if (null == m_topLevelVariables)
  826. m_topLevelVariables = new Vector();
  827. m_topLevelVariables.addElement(v);
  828. }
  829. /**
  830. * Get an "xsl:variable" or "xsl:param" property.
  831. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
  832. *
  833. * @param qname non-null reference to the qualified name of the variable.
  834. *
  835. * @return The ElemVariable with the given name in the list or null
  836. */
  837. public ElemVariable getVariableOrParam(QName qname)
  838. {
  839. if (null != m_topLevelVariables)
  840. {
  841. int n = getVariableOrParamCount();
  842. for (int i = 0; i < n; i++)
  843. {
  844. ElemVariable var = (ElemVariable) getVariableOrParam(i);
  845. if (var.getName().equals(qname))
  846. return var;
  847. }
  848. }
  849. return null;
  850. }
  851. /**
  852. * Get an "xsl:variable" property.
  853. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
  854. *
  855. * @param qname Qualified name of the xsl:variable to get
  856. *
  857. * @return reference to the variable named by qname, or null if not found.
  858. */
  859. public ElemVariable getVariable(QName qname)
  860. {
  861. if (null != m_topLevelVariables)
  862. {
  863. int n = getVariableOrParamCount();
  864. for (int i = 0; i < n; i++)
  865. {
  866. ElemVariable var = getVariableOrParam(i);
  867. if((var.getXSLToken() == Constants.ELEMNAME_VARIABLE) &&
  868. (var.getName().equals(qname)))
  869. return var;
  870. }
  871. }
  872. return null;
  873. }
  874. /**
  875. * Get an "xsl:variable" property.
  876. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
  877. *
  878. * @param i Index of variable to get in the list
  879. *
  880. * @return ElemVariable at the given index in the list
  881. *
  882. * @throws ArrayIndexOutOfBoundsException
  883. */
  884. public ElemVariable getVariableOrParam(int i) throws ArrayIndexOutOfBoundsException
  885. {
  886. if (null == m_topLevelVariables)
  887. throw new ArrayIndexOutOfBoundsException();
  888. return (ElemVariable) m_topLevelVariables.elementAt(i);
  889. }
  890. /**
  891. * Get the number of "xsl:variable" properties.
  892. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
  893. *
  894. * @return the number of "xsl:variable" properties.
  895. */
  896. public int getVariableOrParamCount()
  897. {
  898. return (null != m_topLevelVariables) ? m_topLevelVariables.size() : 0;
  899. }
  900. /**
  901. * Set an "xsl:param" property.
  902. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
  903. *
  904. * @param v A non-null ElemParam reference.
  905. */
  906. public void setParam(ElemParam v)
  907. {
  908. setVariable(v);
  909. }
  910. /**
  911. * Get an "xsl:param" property.
  912. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
  913. *
  914. * @param qname non-null reference to qualified name of the parameter.
  915. *
  916. * @return ElemParam with the given name in the list or null
  917. */
  918. public ElemParam getParam(QName qname)
  919. {
  920. if (null != m_topLevelVariables)
  921. {
  922. int n = getVariableOrParamCount();
  923. for (int i = 0; i < n; i++)
  924. {
  925. ElemVariable var = getVariableOrParam(i);
  926. if((var.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE) &&
  927. (var.getName().equals(qname)))
  928. return (ElemParam)var;
  929. }
  930. }
  931. return null;
  932. }
  933. /**
  934. * The "xsl:template" properties.
  935. * @serial
  936. */
  937. private Vector m_templates;
  938. /**
  939. * Set an "xsl:template" property.
  940. * @see <a href="http://www.w3.org/TR/xslt#section-Defining-Template-Rules">section-Defining-Template-Rules in XSLT Specification</a>
  941. *
  942. * @param v ElemTemplate to add to list of templates
  943. */
  944. public void setTemplate(ElemTemplate v)
  945. {
  946. if (null == m_templates)
  947. m_templates = new Vector();
  948. m_templates.addElement(v);
  949. v.setStylesheet(this);
  950. }
  951. /**
  952. * Get an "xsl:template" property.
  953. * @see <a href="http://www.w3.org/TR/xslt#section-Defining-Template-Rules">section-Defining-Template-Rules in XSLT Specification</a>
  954. *
  955. * @param i Index of ElemTemplate in the list to get
  956. *
  957. * @return ElemTemplate at the given index in the list
  958. *
  959. * @throws TransformerException
  960. */
  961. public ElemTemplate getTemplate(int i) throws TransformerException
  962. {
  963. if (null == m_templates)
  964. throw new ArrayIndexOutOfBoundsException();
  965. return (ElemTemplate) m_templates.elementAt(i);
  966. }
  967. /**
  968. * Get the number of "xsl:template" properties.
  969. * @see <a href="http://www.w3.org/TR/xslt#section-Defining-Template-Rules">section-Defining-Template-Rules in XSLT Specification</a>
  970. *
  971. * @return the number of "xsl:template" properties.
  972. */
  973. public int getTemplateCount()
  974. {
  975. return (null != m_templates) ? m_templates.size() : 0;
  976. }
  977. /**
  978. * The "xsl:namespace-alias" properties.
  979. * @serial
  980. */
  981. private Vector m_prefix_aliases;
  982. /**
  983. * Set the "xsl:namespace-alias" property.
  984. * @see <a href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element in XSLT Specification</a>
  985. *
  986. * @param na NamespaceAlias elemeent to add to the list
  987. */
  988. public void setNamespaceAlias(NamespaceAlias na)
  989. {
  990. if (m_prefix_aliases == null)
  991. m_prefix_aliases = new Vector();
  992. m_prefix_aliases.addElement(na);
  993. }
  994. /**
  995. * Get an "xsl:namespace-alias" property.
  996. * @see <a href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element in XSLT Specification</a>
  997. *
  998. * @param i Index of NamespaceAlias element to get from the list
  999. *
  1000. * @return NamespaceAlias element at the given index in the list
  1001. *
  1002. * @throws ArrayIndexOutOfBoundsException
  1003. */
  1004. public NamespaceAlias getNamespaceAlias(int i)
  1005. throws ArrayIndexOutOfBoundsException
  1006. {
  1007. if (null == m_prefix_aliases)
  1008. throw new ArrayIndexOutOfBoundsException();
  1009. return (NamespaceAlias) m_prefix_aliases.elementAt(i);
  1010. }
  1011. /**
  1012. * Get the number of "xsl:namespace-alias" properties.
  1013. * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
  1014. *
  1015. * @return the number of "xsl:namespace-alias" properties.
  1016. */
  1017. public int getNamespaceAliasCount()
  1018. {
  1019. return (null != m_prefix_aliases) ? m_prefix_aliases.size() : 0;
  1020. }
  1021. /**
  1022. * The "non-xsl-top-level" properties.
  1023. * @serial
  1024. */
  1025. private Hashtable m_NonXslTopLevel;
  1026. /**
  1027. * Set found a non-xslt element.
  1028. * @see <a href="http://www.w3.org/TR/xslt#stylesheet-element">stylesheet-element in XSLT Specification</a>
  1029. *
  1030. * @param name Qualified name of the element
  1031. * @param obj The element object
  1032. */
  1033. public void setNonXslTopLevel(QName name, Object obj)
  1034. {
  1035. if (null == m_NonXslTopLevel)
  1036. m_NonXslTopLevel = new Hashtable();
  1037. m_NonXslTopLevel.put(name, obj);
  1038. }
  1039. /**
  1040. * Get a non-xslt element.
  1041. * @see <a href="http://www.w3.org/TR/xslt#stylesheet-element">stylesheet-element in XSLT Specification</a>
  1042. *
  1043. * @param name Qualified name of the element to get
  1044. *
  1045. * @return The object associate with the given name
  1046. */
  1047. public Object getNonXslTopLevel(QName name)
  1048. {
  1049. return (null != m_NonXslTopLevel) ? m_NonXslTopLevel.get(name) : null;
  1050. }
  1051. // =========== End top-level XSLT properties ===========
  1052. /**
  1053. * The base URL of the XSL document.
  1054. * @serial
  1055. */
  1056. private String m_href = null;
  1057. /** The doctype-public element.
  1058. * @serial */
  1059. private String m_publicId;
  1060. /** The doctype-system element.
  1061. * @serial */
  1062. private String m_systemId;
  1063. /**
  1064. * Get the base identifier with which this stylesheet is associated.
  1065. *
  1066. * @return the base identifier with which this stylesheet is associated.
  1067. */
  1068. public String getHref()
  1069. {
  1070. return m_href;
  1071. }
  1072. /**
  1073. * Set the base identifier with which this stylesheet is associated.
  1074. *
  1075. * @param baseIdent the base identifier with which this stylesheet is associated.
  1076. */
  1077. public void setHref(String baseIdent)
  1078. {
  1079. m_href = baseIdent;
  1080. }
  1081. /**
  1082. * Set the location information for this element.
  1083. *
  1084. * @param locator SourceLocator object with location information
  1085. */
  1086. public void setLocaterInfo(SourceLocator locator)
  1087. {
  1088. if (null != locator)
  1089. {
  1090. m_publicId = locator.getPublicId();
  1091. m_systemId = locator.getSystemId();
  1092. if (null != m_systemId)
  1093. {
  1094. try
  1095. {
  1096. m_href = SystemIDResolver.getAbsoluteURI(m_systemId, null);
  1097. }
  1098. catch (TransformerException se)
  1099. {
  1100. // Ignore this for right now
  1101. }
  1102. }
  1103. super.setLocaterInfo(locator);
  1104. }
  1105. }
  1106. /**
  1107. * The root of the stylesheet, where all the tables common
  1108. * to all stylesheets are kept.
  1109. * @serial
  1110. */
  1111. private StylesheetRoot m_stylesheetRoot;
  1112. /**
  1113. * Get the root of the stylesheet, where all the tables common
  1114. * to all stylesheets are kept.
  1115. *
  1116. * @return the root of the stylesheet
  1117. */
  1118. public StylesheetRoot getStylesheetRoot()
  1119. {
  1120. return m_stylesheetRoot;
  1121. }
  1122. /**
  1123. * Set the root of the stylesheet, where all the tables common
  1124. * to all stylesheets are kept.
  1125. *
  1126. * @param v the root of the stylesheet
  1127. */
  1128. public void setStylesheetRoot(StylesheetRoot v)
  1129. {
  1130. m_stylesheetRoot = v;
  1131. }
  1132. /**
  1133. * The parent of the stylesheet. This will be null if this
  1134. * is the root stylesheet.
  1135. * @serial
  1136. */
  1137. private Stylesheet m_stylesheetParent;
  1138. /**
  1139. * Get the parent of the stylesheet. This will be null if this
  1140. * is the root stylesheet.
  1141. *
  1142. * @return the parent of the stylesheet.
  1143. */
  1144. public Stylesheet getStylesheetParent()
  1145. {
  1146. return m_stylesheetParent;
  1147. }
  1148. /**
  1149. * Set the parent of the stylesheet. This should be null if this
  1150. * is the root stylesheet.
  1151. *
  1152. * @param v the parent of the stylesheet.
  1153. */
  1154. public void setStylesheetParent(Stylesheet v)
  1155. {
  1156. m_stylesheetParent = v;
  1157. }
  1158. /**
  1159. * Get the owning aggregated stylesheet, or this
  1160. * stylesheet if it is aggregated.
  1161. *
  1162. * @return the owning aggregated stylesheet or itself
  1163. */
  1164. public StylesheetComposed getStylesheetComposed()
  1165. {
  1166. Stylesheet sheet = this;
  1167. while (!sheet.isAggregatedType())
  1168. {
  1169. sheet = sheet.getStylesheetParent();
  1170. }
  1171. return (StylesheetComposed) sheet;
  1172. }
  1173. /**
  1174. * Get the type of the node. We'll pretend we're a Document.
  1175. *
  1176. * @return the type of the node: document node.
  1177. */
  1178. public short getNodeType()
  1179. {
  1180. return DTM.DOCUMENT_NODE;
  1181. }
  1182. /**
  1183. * Get an integer representation of the element type.
  1184. *
  1185. * @return An integer representation of the element, defined in the
  1186. * Constants class.
  1187. * @see org.apache.xalan.templates.Constants
  1188. */
  1189. public int getXSLToken()
  1190. {
  1191. return Constants.ELEMNAME_STYLESHEET;
  1192. }
  1193. /**
  1194. * Return the node name.
  1195. *
  1196. * @return The node name
  1197. */
  1198. public String getNodeName()
  1199. {
  1200. return Constants.ELEMNAME_STYLESHEET_STRING;
  1201. }
  1202. /**
  1203. * Replace an "xsl:template" property.
  1204. * This is a hook for CompilingStylesheetHandler, to allow
  1205. * us to access a template, compile it, instantiate it,
  1206. * and replace the original with the compiled instance.
  1207. * ADDED 9/5/2000 to support compilation experiment
  1208. *
  1209. * @param v Compiled template to replace with
  1210. * @param i Index of template to be replaced
  1211. *
  1212. * @throws TransformerException
  1213. */
  1214. public void replaceTemplate(ElemTemplate v, int i) throws TransformerException
  1215. {
  1216. if (null == m_templates)
  1217. throw new ArrayIndexOutOfBoundsException();
  1218. replaceChild(v, (ElemTemplateElement)m_templates.elementAt(i));
  1219. m_templates.setElementAt(v, i);
  1220. v.setStylesheet(this);
  1221. }
  1222. /**
  1223. * Call the children visitors.
  1224. * @param visitor The visitor whose appropriate method will be called.
  1225. */
  1226. protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs)
  1227. {
  1228. int s = getImportCount();
  1229. for (int j = 0; j < s; j++)
  1230. {
  1231. getImport(j).callVisitors(visitor);
  1232. }
  1233. s = getIncludeCount();
  1234. for (int j = 0; j < s; j++)
  1235. {
  1236. getInclude(j).callVisitors(visitor);
  1237. }
  1238. s = getOutputCount();
  1239. for (int j = 0; j < s; j++)
  1240. {
  1241. visitor.visitTopLevelInstruction(getOutput(j));
  1242. }
  1243. // Next, add in the attribute-set elements
  1244. s = getAttributeSetCount();
  1245. for (int j = 0; j < s; j++)
  1246. {
  1247. ElemAttributeSet attrSet = getAttributeSet(j);
  1248. if (visitor.visitTopLevelInstruction(attrSet))
  1249. {
  1250. attrSet.callChildVisitors(visitor);
  1251. }
  1252. }
  1253. // Now the decimal-formats
  1254. s = getDecimalFormatCount();
  1255. for (int j = 0; j < s; j++)
  1256. {
  1257. visitor.visitTopLevelInstruction(getDecimalFormat(j));
  1258. }
  1259. // Now the keys
  1260. s = getKeyCount();
  1261. for (int j = 0; j < s; j++)
  1262. {
  1263. visitor.visitTopLevelInstruction(getKey(j));
  1264. }
  1265. // And the namespace aliases
  1266. s = getNamespaceAliasCount();
  1267. for (int j = 0; j < s; j++)
  1268. {
  1269. visitor.visitTopLevelInstruction(getNamespaceAlias(j));
  1270. }
  1271. // Next comes the templates
  1272. s = getTemplateCount();
  1273. for (int j = 0; j < s; j++)
  1274. {
  1275. try
  1276. {
  1277. ElemTemplate template = getTemplate(j);
  1278. if (visitor.visitTopLevelInstruction(template))
  1279. {
  1280. template.callChildVisitors(visitor);
  1281. }
  1282. }
  1283. catch (TransformerException te)
  1284. {
  1285. throw new org.apache.xml.utils.WrappedRuntimeException(te);
  1286. }
  1287. }
  1288. // Then, the variables
  1289. s = getVariableOrParamCount();
  1290. for (int j = 0; j < s; j++)
  1291. {
  1292. ElemVariable var = getVariableOrParam(j);
  1293. if (visitor.visitTopLevelVariableOrParamDecl(var))
  1294. {
  1295. var.callChildVisitors(visitor);
  1296. }
  1297. }
  1298. // And lastly the whitespace preserving and stripping elements
  1299. s = getStripSpaceCount();
  1300. for (int j = 0; j < s; j++)
  1301. {
  1302. visitor.visitTopLevelInstruction(getStripSpace(j));
  1303. }
  1304. s = getPreserveSpaceCount();
  1305. for (int j = 0; j < s; j++)
  1306. {
  1307. visitor.visitTopLevelInstruction(getPreserveSpace(j));
  1308. }
  1309. if(null != m_NonXslTopLevel)
  1310. {
  1311. java.util.Enumeration enum = m_NonXslTopLevel.elements();
  1312. while(enum.hasMoreElements())
  1313. {
  1314. ElemTemplateElement elem = (ElemTemplateElement)enum.nextElement();
  1315. if (visitor.visitTopLevelInstruction(elem))
  1316. {
  1317. elem.callChildVisitors(visitor);
  1318. }
  1319. }
  1320. }
  1321. }
  1322. /**
  1323. * Accept a visitor and call the appropriate method
  1324. * for this class.
  1325. *
  1326. * @param visitor The visitor whose appropriate method will be called.
  1327. * @return true if the children of the object should be visited.
  1328. */
  1329. protected boolean accept(XSLTVisitor visitor)
  1330. {
  1331. return visitor.visitStylesheet(this);
  1332. }
  1333. }