19f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/* 29f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one 39f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * or more contributor license agreements. See the NOTICE file 49f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed with this work for additional information 59f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * regarding copyright ownership. The ASF licenses this file 69f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * to you under the Apache License, Version 2.0 (the "License"); 79f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * you may not use this file except in compliance with the License. 89f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * You may obtain a copy of the License at 99f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * http://www.apache.org/licenses/LICENSE-2.0 119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Unless required by applicable law or agreed to in writing, software 139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS, 149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * See the License for the specific language governing permissions and 169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * limitations under the License. 179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/* 199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * $Id: TemplateSubPatternAssociation.java 468643 2006-10-28 06:56:03Z minchau $ 209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonpackage org.apache.xalan.templates; 229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport java.io.Serializable; 249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport javax.xml.transform.TransformerException; 269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xml.utils.QName; 289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xpath.XPath; 299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xpath.XPathContext; 309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonimport org.apache.xpath.patterns.StepPattern; 319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson/** 339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * A class to contain a match pattern and it's corresponding template. 349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * This class also defines a node in a match pattern linked list. 359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilsonclass TemplateSubPatternAssociation implements Serializable, Cloneable 379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson{ 389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson static final long serialVersionUID = -8902606755229903350L; 399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** Step pattern */ 419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson StepPattern m_stepPattern; 429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** Template pattern */ 449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson private String m_pattern; 459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** The template element */ 479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson private ElemTemplate m_template; 489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** Next pattern */ 509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson private TemplateSubPatternAssociation m_next = null; 519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** Flag indicating whether this is wild card pattern */ 539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson private boolean m_wild; 549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** Target string for this match pattern */ 569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson private String m_targetString; 579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Construct a match pattern from a pattern and template. 609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param template The node that contains the template for this pattern. 619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param pattern An executable XSLT StepPattern. 629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param pat For now a Nodelist that contains old-style element patterns. 639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson TemplateSubPatternAssociation(ElemTemplate template, StepPattern pattern, String pat) 659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson m_pattern = pat; 689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson m_template = template; 699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson m_stepPattern = pattern; 709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson m_targetString = m_stepPattern.getTargetString(); 719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson m_wild = m_targetString.equals("*"); 729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Clone this object. 769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return The cloned object. 789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @throws CloneNotSupportedException 809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public Object clone() throws CloneNotSupportedException 829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson TemplateSubPatternAssociation tspa = 859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson (TemplateSubPatternAssociation) super.clone(); 869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson tspa.m_next = null; 889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return tspa; 909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get the target string of the pattern. For instance, if the pattern is 949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * "foo/baz/boo[@daba]", this string will be "boo". 959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return The "target" string. 979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public final String getTargetString() 999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 1009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return m_targetString; 1019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 1029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Set Target String for this template pattern 1059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param key Target string to set 1089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void setTargetString(String key) 1109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 1119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson m_targetString = key; 1129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 1139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Tell if two modes match according to the rules of XSLT. 1169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param m1 mode to match 1189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return True if the given mode matches this template's mode 1209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson boolean matchMode(QName m1) 1229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 1239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return matchModes(m1, m_template.getMode()); 1249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 1259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Tell if two modes match according to the rules of XSLT. 1289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param m1 First mode to match 1309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param m2 Second mode to match 1319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return True if the two given modes match 1339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson private boolean matchModes(QName m1, QName m2) 1359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 1369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return (((null == m1) && (null == m2)) 1379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson || ((null != m1) && (null != m2) && m1.equals(m2))); 1389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 1399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return the mode associated with the template. 1429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param xctxt XPath context to use with this template 1459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param targetNode Target node 1469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param mode reference, which may be null, to the <a href="http://www.w3.org/TR/xslt#modes">current mode</a>. 1479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return The mode associated with the template. 1489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @throws TransformerException 1509f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1519f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public boolean matches(XPathContext xctxt, int targetNode, QName mode) 1529f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson throws TransformerException 1539f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 1549f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1559f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson double score = m_stepPattern.getMatchScore(xctxt, targetNode); 1569f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1579f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return (XPath.MATCH_SCORE_NONE != score) 1589f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson && matchModes(mode, m_template.getMode()); 1599f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 1609f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1619f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1629f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Tell if the pattern for this association is a wildcard. 1639f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1649f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return true if this pattern is considered to be a wild match. 1659f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1669f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public final boolean isWild() 1679f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 1689f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return m_wild; 1699f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 1709f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1719f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1729f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get associated XSLT StepPattern. 1739f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1749f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return An executable StepPattern object, never null. 1759f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1769f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1779f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public final StepPattern getStepPattern() 1789f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 1799f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return m_stepPattern; 1809f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 1819f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1829f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1839f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get the pattern string for diagnostic purposes. 1849f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1859f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return The pattern string for diagnostic purposes. 1869f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1879f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1889f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public final String getPattern() 1899f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 1909f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return m_pattern; 1919f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 1929f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 1939f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 1949f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return the position of the template in document 1959f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * order in the stylesheet. 1969f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 1979f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return The position of the template in the overall template order. 1989f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 1999f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public int getDocOrderPos() 2009f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 2019f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return m_template.getUid(); 2029f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 2039f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2049f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2059f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Return the import level associated with the stylesheet into which 2069f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * this template is composed. 2079f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2089f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return The import level of this template. 2099f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2109f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public final int getImportLevel() 2119f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 2129f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return m_template.getStylesheetComposed().getImportCountComposed(); 2139f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 2149f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2159f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2169f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get the assocated xsl:template. 2179f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2189f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return An ElemTemplate, never null. 2199f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2209f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2219f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public final ElemTemplate getTemplate() 2229f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 2239f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return m_template; 2249f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 2259f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2269f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2279f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Get the next association. 2289f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2299f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @return A valid TemplateSubPatternAssociation, or null. 2309f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2319f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public final TemplateSubPatternAssociation getNext() 2329f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 2339f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson return m_next; 2349f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 2359f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson 2369f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson /** 2379f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * Set the next element on this association 2389f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * list, which should be equal or less in priority to 2399f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * this association, and, if equal priority, should occur 2409f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * before this template in document order. 2419f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2429f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * @param mp The next association to score if this one fails. 2439f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson * 2449f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson */ 2459f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson public void setNext(TemplateSubPatternAssociation mp) 2469f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson { 2479f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson m_next = mp; 2489f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson } 2499f8118474e9513f7a5b7d2a05e4a0fb15d1a6569Jesse Wilson} 250