You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/05/11 20:17:07 UTC
cvs commit: xml-xalan/c/src/XSLT ElemLiteralResult.cpp ElemLiteralResult.hpp NamespacesHandler.cpp NamespacesHandler.hpp
dbertoni 01/05/11 11:17:05
Modified: c/src/XSLT ElemLiteralResult.cpp ElemLiteralResult.hpp
NamespacesHandler.cpp NamespacesHandler.hpp
Log:
Make sure the NamespacesHandler knows which prefixes are being used, so that it emits the appropriate namespace declarations (lre10).
Revision Changes Path
1.35 +30 -2 xml-xalan/c/src/XSLT/ElemLiteralResult.cpp
Index: ElemLiteralResult.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- ElemLiteralResult.cpp 2001/04/30 18:12:49 1.34
+++ ElemLiteralResult.cpp 2001/05/11 18:16:33 1.35
@@ -197,6 +197,34 @@
void
+ElemLiteralResult::postConstruction(const NamespacesHandler& theParentHandler)
+{
+ // OK, now check all attribute AVTs to make sure
+ // our NamespacesHandler knows about any prefixes
+ // that will need namespace declarations...
+ const AVTVectorType::size_type nAttrs = m_avts.size();
+
+ for(AVTVectorType::size_type i = 0; i < nAttrs; ++i)
+ {
+ const AVT* const avt = m_avts[i];
+
+ const XalanDOMString& theName = avt->getName();
+
+ const unsigned int theColonIndex = indexOf(theName, XalanUnicode::charColon);
+
+ if (theColonIndex != length(theName))
+ {
+ m_namespacesHandler.addActivePrefix(substring(theName, 0, theColonIndex));
+ }
+ }
+
+ // OK, now we can chain-up...
+ ElemUse::postConstruction(theParentHandler);
+}
+
+
+
+void
ElemLiteralResult::execute(StylesheetExecutionContext& executionContext) const
{
executionContext.startElement(c_wstr(getElementName()));
@@ -215,7 +243,7 @@
XalanDOMString& thePrefix = theGuard1.get();
XalanDOMString& theStringedValue = theGuard2.get();
- for(AVTVectorType::size_type i = 0; i < nAttrs; i++)
+ for(AVTVectorType::size_type i = 0; i < nAttrs; ++i)
{
const AVT* const avt = m_avts[i];
@@ -236,7 +264,7 @@
theStringedValue) == false)
{
executionContext.addResultAttribute(
- avt->getName(),
+ theName,
theStringedValue);
}
1.19 +3 -0 xml-xalan/c/src/XSLT/ElemLiteralResult.hpp
Index: ElemLiteralResult.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemLiteralResult.hpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- ElemLiteralResult.hpp 2001/03/09 16:20:01 1.18
+++ ElemLiteralResult.hpp 2001/05/11 18:16:38 1.19
@@ -104,6 +104,9 @@
virtual const XalanDOMString&
getElementName() const;
+ virtual void
+ postConstruction(const NamespacesHandler& theParentHandler);
+
virtual bool
isAttrOK(
int tok,
1.8 +11 -0 xml-xalan/c/src/XSLT/NamespacesHandler.cpp
Index: NamespacesHandler.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NamespacesHandler.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- NamespacesHandler.cpp 2001/02/09 19:22:31 1.7
+++ NamespacesHandler.cpp 2001/05/11 18:16:41 1.8
@@ -83,6 +83,7 @@
m_namespaceDeclarations(),
m_extensionNamespaceURIs(),
m_namespaceAliases(),
+ m_activePrefixes(),
m_processAliases(true)
{
}
@@ -97,6 +98,7 @@
m_namespaceDeclarations(),
m_extensionNamespaceURIs(),
m_namespaceAliases(),
+ m_activePrefixes(),
m_processAliases(true)
{
// Go through the namespaces stack in reverse order...
@@ -149,6 +151,7 @@
m_namespaceDeclarations(theSource.m_namespaceDeclarations),
m_extensionNamespaceURIs(theSource.m_extensionNamespaceURIs),
m_namespaceAliases(theSource.m_namespaceAliases),
+ m_activePrefixes(theSource.m_activePrefixes),
m_processAliases(theSource.m_processAliases)
{
}
@@ -326,6 +329,9 @@
processNamespaceAliases();
createResultAttributeNames();
+
+ // We don't need these any more...
+ m_activePrefixes.clear();
}
@@ -447,6 +453,8 @@
m_extensionNamespaceURIs.clear();
m_namespaceAliases.clear();
+
+ m_activePrefixes.clear();
}
@@ -461,6 +469,8 @@
m_extensionNamespaceURIs.swap(theOther.m_extensionNamespaceURIs);
m_namespaceAliases.swap(theOther.m_namespaceAliases);
+
+ m_activePrefixes.swap(theOther.m_activePrefixes);
}
@@ -543,6 +553,7 @@
// We can never exclude the prefix of our owner element, so
// check that first...
if (equals(thePrefix, theElementPrefix) == false &&
+ m_activePrefixes.find(thePrefix) == m_activePrefixes.end() &&
(m_excludedResultPrefixes.find(thePrefix) != m_excludedResultPrefixes.end() ||
m_extensionNamespaceURIs.find(theURI) != m_extensionNamespaceURIs.end()))
{
1.6 +18 -0 xml-xalan/c/src/XSLT/NamespacesHandler.hpp
Index: NamespacesHandler.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/NamespacesHandler.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NamespacesHandler.hpp 2001/01/30 22:02:22 1.5
+++ NamespacesHandler.hpp 2001/05/11 18:16:45 1.6
@@ -178,6 +178,9 @@
typedef set<XalanDOMString,
less<XalanDOMString> > ExtensionNamespaceURISetType;
+
+ typedef set<XalanDOMString,
+ less<XalanDOMString> > ActivePrefixesSetType;
#else
typedef std::map<XalanDOMString, XalanDOMString> ExcludedResultPrefixesMapType;
@@ -187,6 +190,8 @@
typedef std::map<XalanDOMString, XalanDOMString> NamespaceAliasesMapType;
typedef std::set<XalanDOMString> ExtensionNamespaceURISetType;
+
+ typedef std::set<XalanDOMString> ActivePrefixesSetType;
#endif
/**
@@ -323,6 +328,17 @@
}
/**
+ * Add a prefix to the list of active prefixes.
+ *
+ * @param thePrefix The prefix that is active and requires a namespace declaration.
+ */
+ void
+ addActivePrefix(const XalanDOMString& thePrefix)
+ {
+ m_activePrefixes.insert(thePrefix);
+ }
+
+ /**
* Copy the aliases from the given NamespacesHandler.
*
* @param parentNamespacesHandler The parent handler.
@@ -437,6 +453,8 @@
ExtensionNamespaceURISetType m_extensionNamespaceURIs;
NamespaceAliasesMapType m_namespaceAliases;
+
+ ActivePrefixesSetType m_activePrefixes;
// If true namespace aliases will be processed. If false, they will not.
bool m_processAliases;
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org