dbertoni 01/11/26 15:27:04
Modified: c/src/XSLT ElemDecimalFormat.cpp ElemDecimalFormat.hpp
Log:
Use QName instead of NCName for the name of an instance. Detect duplicate
instances as appropriate.
Revision Changes Path
1.8 +47 -27 xml-xalan/c/src/XSLT/ElemDecimalFormat.cpp
Index: ElemDecimalFormat.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemDecimalFormat.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemDecimalFormat.cpp 2001/07/12 05:05:40 1.7
+++ ElemDecimalFormat.cpp 2001/11/26 23:27:03 1.8
@@ -86,13 +86,13 @@
m_countMatchPattern(0),
m_fromMatchPattern(0),
m_valueExpr(0),
- m_name_avt(),
+ m_qname(),
m_decimalFormatSymbols()
{
m_decimalFormatSymbols.setInfinity(XalanDOMString());
m_decimalFormatSymbols.setNaN(XalanDOMString());
- const unsigned int nAttrs = atts.getLength();
+ const unsigned int nAttrs = atts.getLength();
for(unsigned int i = 0; i < nAttrs; i++)
{
@@ -102,7 +102,7 @@
{
assert(atts.getValue(i) != 0);
- m_name_avt = atts.getValue(i);
+ m_qname = XalanQNameByValue(atts.getValue(i),
getStylesheet().getNamespaces());;
}
else if(equals(aname, Constants::ATTRNAME_DECIMALSEPARATOR))
{
@@ -115,7 +115,10 @@
}
else
{
- constructionContext.warn("Illegal attribute
value", 0, this);
+ constructionContext.warn(
+ "xsl:decimal-format has an illegal
decimal-separator attribute value",
+ 0,
+ this);
}
}
else if(equals(aname, Constants::ATTRNAME_GROUPINGSEPARATOR))
@@ -129,7 +132,10 @@
}
else
{
- constructionContext.warn("Illegal attribute
value", 0, this);
+ constructionContext.warn(
+ "xsl:decimal-format has an illegal
'grouping-separator' value",
+ 0,
+ this);
}
}
else if(equals(aname, Constants::ATTRNAME_INFINITY))
@@ -149,7 +155,10 @@
}
else
{
- constructionContext.warn("Illegal attribute
value", 0, this);
+ constructionContext.warn(
+ "xsl:decimal-format has an illegal
'minus-sign' value",
+ 0,
+ this);
}
}
else if(equals(aname, Constants::ATTRNAME_NAN))
@@ -169,7 +178,10 @@
}
else
{
- constructionContext.warn("Illegal attribute
value", 0, this);
+ constructionContext.warn(
+ "xsl:decimal-format has an illegal
'percent' value",
+ 0,
+ this);
}
}
else if(equals(aname, Constants::ATTRNAME_PERMILLE))
@@ -183,7 +195,10 @@
}
else
{
- constructionContext.warn("Illegal attribute
value", 0, this);
+ constructionContext.warn(
+ "xsl:decimal-format has an illegal
'per-mille' value",
+ 0,
+ this);
}
}
else if(equals(aname, Constants::ATTRNAME_ZERODIGIT))
@@ -197,7 +212,10 @@
}
else
{
- constructionContext.warn("Illegal attribute
value", 0, this);
+ constructionContext.warn(
+ "xsl:decimal-format has an illegal
'zero-digit' value",
+ 0,
+ this);
}
}
else if(equals(aname, Constants::ATTRNAME_DIGIT))
@@ -211,7 +229,10 @@
}
else
{
- constructionContext.warn("Illegal attribute
value", 0, this);
+ constructionContext.warn(
+ "xsl:decimal-format has an illegal
'digit' value",
+ 0,
+ this);
}
}
else if(equals(aname, Constants::ATTRNAME_PATTERNSEPARATOR))
@@ -225,12 +246,18 @@
}
else
{
- constructionContext.warn("Illegal attribute
value", 0, this);
+ constructionContext.warn(
+ "xsl:decimal-format has an illegal
'pattern-separator' value",
+ 0,
+ this);
}
}
else if(!isAttrOK(aname, atts, i, constructionContext))
{
- constructionContext.error("xsl:decimal-format has an
illegal attribute", 0, this);
+ constructionContext.error(
+ "xsl:decimal-format has an illegal attribute",
+ 0,
+ this);
}
}
@@ -244,23 +271,16 @@
m_decimalFormatSymbols.setNaN(Constants::ATTRVAL_NAN);
}
- // Look for the default decimal-format element
- if (length(m_name_avt) == 0)
- {
- if
(getStylesheet().getDecimalFormatSymbols(Constants::DEFAULT_DECIMAL_FORMAT) !=
0)
- {
- constructionContext.warn("Only one default
xsl:decimal-format is allowed", 0, this);
- }
-
- m_name_avt = Constants::DEFAULT_DECIMAL_FORMAT;
- }
// Look for duplicate decimal-format names
- else
+ const XalanDecimalFormatSymbols* const theOther =
+ stylesheetTree.getDecimalFormatSymbols(m_qname);
+
+ if (theOther != 0 && *theOther != m_decimalFormatSymbols)
{
- if (getStylesheet().getDecimalFormatSymbols(m_name_avt) != 0)
- {
- constructionContext.warn("All xsl:decimal-format
elements must be unique", 0, this);
- }
+ constructionContext.error(
+ "Duplicate definition of xsl:decimal-format element",
+ 0,
+ this);
}
}
1.9 +8 -4 xml-xalan/c/src/XSLT/ElemDecimalFormat.hpp
Index: ElemDecimalFormat.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemDecimalFormat.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemDecimalFormat.hpp 2001/03/09 16:20:04 1.8
+++ ElemDecimalFormat.hpp 2001/11/26 23:27:03 1.9
@@ -73,6 +73,10 @@
+#include <XPath/XalanQNameByValue.hpp>
+
+
+
class XPath;
@@ -113,10 +117,10 @@
return m_decimalFormatSymbols;
}
- const XalanDOMString&
- getName() const
+ const XalanQName&
+ getQName() const
{
- return m_name_avt;
+ return m_qname;
}
private:
@@ -125,7 +129,7 @@
const XPath* m_fromMatchPattern;
const XPath* m_valueExpr;
- XalanDOMString m_name_avt;
+ XalanQNameByValue m_qname;
XalanDecimalFormatSymbols m_decimalFormatSymbols;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]