XALAN_CPP_NAMESPACE_BEGIN ElemComment::ElemComment( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const AttributeListType& atts, int lineNumber, int columnNumber) : ElemTemplateElement(constructionContext, stylesheetTree, lineNumber, columnNumber, StylesheetConstructionContext::ELEMNAME_COMMENT) { const unsigned int nAttrs = atts.getLength(); for(unsigned int i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i, constructionContext)) { constructionContext.error( XalanMessageLoader::getMessage( XalanMessages::TemplateHasIllegalAttribute_2Param, Constants::ELEMNAME_COMMENT_WITH_PREFIX_STRING.c_str(), aname), 0, this); } } }
void ElemVariable::init( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const AttributeListType& atts) { const unsigned int nAttrs = atts.getLength(); for(unsigned int i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); if (equals(aname, Constants::ATTRNAME_SELECT)) { m_selectPattern = constructionContext.createXPath(getLocator(), atts.getValue(i), *this); } else if (equals(aname, Constants::ATTRNAME_NAME)) { m_qname = constructionContext.createXalanQName( atts.getValue(i), stylesheetTree.getNamespaces(), getLocator()); if (m_qname->isValid() == false) { constructionContext.error( XalanMessageLoader::getMessage( XalanMessages::AttributeValueNotValidQName_2Param, Constants::ATTRNAME_NAME.c_str(), atts.getValue(i)), 0, this); } } else if(!(isAttrOK(aname, atts, i, constructionContext) || processSpaceAttr(aname, atts, i, constructionContext))) { constructionContext.error( XalanMessageLoader::getMessage( XalanMessages::TemplateHasIllegalAttribute_2Param, Constants::ELEMNAME_VARIABLE_WITH_PREFIX_STRING.c_str(), aname), 0, this); } } if(m_qname == 0) { constructionContext.error( XalanMessageLoader::getMessage( XalanMessages::TemplateMustHaveAttribute_2Param, Constants::ELEMNAME_VARIABLE_WITH_PREFIX_STRING, Constants::ATTRNAME_NAME), 0, this); } }
XALAN_CPP_NAMESPACE_BEGIN ElemPI::ElemPI( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const AttributeListType& atts, XalanFileLoc lineNumber, XalanFileLoc columnNumber) : ElemTemplateElement( constructionContext, stylesheetTree, lineNumber, columnNumber, StylesheetConstructionContext::ELEMNAME_PI), m_nameAVT(0) { const XalanSize_t nAttrs = atts.getLength(); for(XalanSize_t i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); if (equals(aname, Constants::ATTRNAME_NAME)) { m_nameAVT = constructionContext.createAVT(getLocator(), aname, atts.getValue(i), *this); } else if (isAttrOK( aname, atts, i, constructionContext) == false && processSpaceAttr( Constants::ELEMNAME_PI_WITH_PREFIX_STRING.c_str(), aname, atts, i, constructionContext) == false) { error( constructionContext, XalanMessages::ElementHasIllegalAttribute_2Param, Constants::ELEMNAME_PI_WITH_PREFIX_STRING.c_str(), aname); } } if (0 == m_nameAVT) { error( constructionContext, XalanMessages::ElementMustHaveAttribute_2Param, Constants::ELEMNAME_PI_WITH_PREFIX_STRING, Constants::ATTRNAME_NAME); } }
XALAN_CPP_NAMESPACE_BEGIN ElemForEach::ElemForEach( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const AttributeListType& atts, int lineNumber, int columnNumber) : ElemTemplateElement(constructionContext, stylesheetTree, lineNumber, columnNumber, StylesheetConstructionContext::ELEMNAME_FOR_EACH), m_selectPattern(0), m_sortElems(), m_sortElemsCount(0) { const unsigned int nAttrs = atts.getLength(); for(unsigned int i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); if(equals(aname, Constants::ATTRNAME_SELECT)) { m_selectPattern = constructionContext.createXPath(getLocator(), atts.getValue(i), *this); } else if(!(isAttrOK(aname, atts, i, constructionContext) || processSpaceAttr(aname, atts, i, constructionContext))) { constructionContext.error( XalanMessageLoader::getMessage( XalanMessages::TemplateHasIllegalAttribute_2Param, Constants::ELEMNAME_FOREACH_WITH_PREFIX_STRING.c_str(), aname), 0, this); } } if(0 == m_selectPattern) { constructionContext.error( XalanMessageLoader::getMessage( XalanMessages::TemplateMustHaveAttribute_2Param, Constants::ELEMNAME_FOREACH_WITH_PREFIX_STRING, Constants::ATTRNAME_SELECT), 0, this); } }
XALAN_CPP_NAMESPACE_BEGIN ElemMessage::ElemMessage( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const AttributeListType& atts, int lineNumber, int columnNumber) : ElemTemplateElement(constructionContext, stylesheetTree, lineNumber, columnNumber, StylesheetConstructionContext::ELEMNAME_MESSAGE), m_terminate(false) { const unsigned int nAttrs = atts.getLength(); for(unsigned int i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); if (equals(aname, Constants::ATTRNAME_TERMINATE) == true) { const XalanDOMChar* const avalue = atts.getValue(i); if (equals(avalue, Constants::ATTRVAL_YES) == true) { m_terminate = true; } else if (equals(avalue, Constants::ATTRVAL_NO) == false) { constructionContext.error( XalanMessageLoader::getMessage(XalanMessages::AttributeHasIllegalValue_1Param,Constants::ATTRNAME_TERMINATE), 0, this); } } else if(isAttrOK(aname, atts, i, constructionContext) == false || processSpaceAttr(aname, atts, i, constructionContext)) { constructionContext.error( XalanMessageLoader::getMessage( XalanMessages::TemplateHasIllegalAttribute_2Param, Constants::ELEMNAME_MESSAGE_WITH_PREFIX_STRING.c_str(), aname), 0, this); } } }
XALAN_CPP_NAMESPACE_BEGIN ElemOtherwise::ElemOtherwise( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const AttributeListType& atts, XalanFileLoc lineNumber, XalanFileLoc columnNumber) : ElemTemplateElement( constructionContext, stylesheetTree, lineNumber, columnNumber, StylesheetConstructionContext::ELEMNAME_OTHERWISE) { const XalanSize_t nAttrs = atts.getLength(); for (XalanSize_t i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); if (isAttrOK( aname, atts, i, constructionContext) == false && processSpaceAttr( Constants::ELEMNAME_OTHERWISE_WITH_PREFIX_STRING.c_str(), aname, atts, i, constructionContext) == false) { error( constructionContext, XalanMessages::ElementHasIllegalAttribute_2Param, Constants::ELEMNAME_OTHERWISE_WITH_PREFIX_STRING.c_str(), aname); } } }
XALAN_CPP_NAMESPACE_BEGIN ElemFallback::ElemFallback( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const AttributeListType& atts, int lineNumber, int columnNumber) : ElemTemplateElement(constructionContext, stylesheetTree, lineNumber, columnNumber, StylesheetConstructionContext::ELEMNAME_FALLBACK) { const unsigned int nAttrs = atts.getLength(); for(unsigned int i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); if (isAttrOK( aname, atts, i, constructionContext) == false && processSpaceAttr( Constants::ELEMNAME_FALLBACK_WITH_PREFIX_STRING.c_str(), aname, atts, i, constructionContext) == false) { error( constructionContext, XalanMessages::ElementHasIllegalAttribute_2Param, Constants::ELEMNAME_FALLBACK_WITH_PREFIX_STRING.c_str(), aname); } } }
ElemTemplate::ElemTemplate( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const AttributeListType& atts, int lineNumber, int columnNumber) : ElemTemplateElement(constructionContext, stylesheetTree, lineNumber, columnNumber, StylesheetConstructionContext::ELEMNAME_TEMPLATE), m_matchPattern(0), m_name(&s_empty), m_mode(&s_empty), m_priority(XPath::getMatchScoreValue(XPath::eMatchScoreNone)) { const unsigned int nAttrs = atts.getLength(); for(unsigned int i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); if (equals(aname, Constants::ATTRNAME_MATCH)) { m_matchPattern = constructionContext.createMatchPattern(getLocator(), atts.getValue(i), *this); } else if (equals(aname, Constants::ATTRNAME_NAME)) { m_name = constructionContext.createXalanQName( atts.getValue(i), getStylesheet().getNamespaces(), getLocator()); if (m_name->isValid() == false) { error( constructionContext, XalanMessages::AttributeValueNotValidQName_2Param, aname, atts.getValue(i)); } } else if (equals(aname, Constants::ATTRNAME_PRIORITY)) { assert(atts.getValue(i) != 0); m_priority = DoubleSupport::toDouble(atts.getValue(i), constructionContext.getMemoryManager()); } else if (equals(aname, Constants::ATTRNAME_MODE)) { m_mode = constructionContext.createXalanQName( atts.getValue(i), getStylesheet().getNamespaces(), getLocator()); if (m_mode->isValid() == false) { error( constructionContext, XalanMessages::AttributeValueNotValidQName_2Param, aname, atts.getValue(i)); } } else if(isAttrOK( aname, atts, i, constructionContext) == false && processSpaceAttr( Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING.c_str(), aname, atts, i, constructionContext) == false) { error( constructionContext, XalanMessages::ElementHasIllegalAttribute_2Param, Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING.c_str(), aname); } } if(0 == m_matchPattern && m_name->isEmpty() == true) { error( constructionContext, XalanMessages::ElementRequiresEitherNameOrMatchAttribute_1Param, Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING); } assert(m_name->isEmpty() == true || m_name->isValid() == true); assert(m_mode->isEmpty() == true || m_mode->isValid() == true); }
void ElemLiteralResult::init( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const XalanDOMChar* name, const AttributeListType& atts) { assert(name != 0); hasPrefix(indexOf(name, XalanUnicode::charColon) < length(name) ? true : false); const unsigned int nAttrs = atts.getLength(); // This over-allocates, but we probably won't waste that much space. m_avts = constructionContext.allocateAVTPointerVector(nAttrs); assert(m_avts != 0); const StylesheetConstructionContext::GetAndReleaseCachedString theGuard(constructionContext); XalanDOMString& theBuffer = theGuard.get(); for(unsigned int i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); bool needToProcess = true; const XalanDOMString::size_type indexOfNSSep = indexOf(aname, XalanUnicode::charColon); const XalanDOMString::size_type len = length(aname); if(indexOfNSSep < len) { substring(aname, theBuffer, 0, indexOfNSSep); if(!equals(theBuffer, DOMServices::s_XMLNamespace)) { const XalanDOMString* const ns = getNamespaceForPrefixInternal(theBuffer); if(ns == 0) { constructionContext.error( XalanMessageLoader::getMessage(XalanMessages::UndeclaredNamespacePrefix_1Param, theBuffer), 0, this); } else if(equals(*ns, stylesheetTree.getXSLTNamespaceURI())) { theBuffer.assign(aname + indexOfNSSep + 1, len - (indexOfNSSep + 1)); if(processPrefixControl(constructionContext, stylesheetTree, theBuffer, atts.getValue(i)) == true) { needToProcess = false; } else if (equals(theBuffer, Constants::ATTRNAME_VERSION) == true) { const XalanDOMChar* const value = atts.getValue(i); stylesheetTree.setXSLTVerDeclared(DoubleSupport::toDouble(value)); } } } else { // don't process namespace decls needToProcess = false; } } if(needToProcess == true) { processSpaceAttr(aname, atts, i, constructionContext); // Add xmlns attribute(except xmlns:xsl), xml:space, etc... // Ignore anything with xsl:xxx if(! processUseAttributeSets(constructionContext, aname, atts, i) && isAttrOK(aname, atts, i, constructionContext)) { m_avts[m_avtsCount++] = constructionContext.createAVT(getLocator(), aname, atts.getValue(i), *this); } } } }
XALAN_CPP_NAMESPACE_BEGIN ElemElement::ElemElement( StylesheetConstructionContext& constructionContext, Stylesheet& stylesheetTree, const AttributeListType& atts, int lineNumber, int columnNumber) : ElemUse(constructionContext, stylesheetTree, lineNumber, columnNumber, StylesheetConstructionContext::ELEMNAME_ELEMENT), m_nameAVT(0), m_namespaceAVT(0) { // Namespace aliases are not used for xsl:element, so // turn them off... // m_namespacesHandler.setProcessNamespaceAliaises(false); const unsigned int nAttrs = atts.getLength(); for(unsigned int i = 0; i < nAttrs; i++) { const XalanDOMChar* const aname = atts.getName(i); if(equals(aname, Constants::ATTRNAME_NAME)) { m_nameAVT = constructionContext.createAVT(getLocator(), aname, atts.getValue(i), *this); } else if(equals(aname, Constants::ATTRNAME_NAMESPACE)) { m_namespaceAVT = constructionContext.createAVT(getLocator(), aname, atts.getValue(i), *this); } else if(!(processUseAttributeSets(constructionContext, aname, atts, i) || processSpaceAttr(aname, atts, i, constructionContext) || isAttrOK(aname, atts, i, constructionContext))) { constructionContext.error( XalanMessageLoader::getMessage( XalanMessages::TemplateHasIllegalAttribute_2Param, Constants::ELEMNAME_ELEMENT_WITH_PREFIX_STRING.c_str(), aname), 0, this); } } if(0 == m_nameAVT) { constructionContext.error( XalanMessageLoader::getMessage(XalanMessages::TemplateMustHaveAttribute_2Param ,Constants::ELEMNAME_ELEMENT_WITH_PREFIX_STRING ,Constants::ATTRNAME_NAME), 0, this); } }