mirror of
https://github.com/jezhiggins/arabica
synced 2024-11-17 07:48:50 +01:00
don't output attributes in the xsl namespace or declare the namespace itself
This commit is contained in:
parent
2053c94f4a
commit
68a6d52d11
2 changed files with 14 additions and 3 deletions
|
@ -8,13 +8,13 @@ namespace XSLT
|
|||
|
||||
struct StylesheetConstant
|
||||
{
|
||||
static const std::string NamespaceURI()
|
||||
static const std::string& NamespaceURI()
|
||||
{
|
||||
static std::string namespaceURI = "http://www.w3.org/1999/XSL/Transform";
|
||||
return namespaceURI;
|
||||
} // XSLTNamespaceURI
|
||||
|
||||
static const std::string Version()
|
||||
static const std::string& Version()
|
||||
{
|
||||
static std::string version = "1.0";
|
||||
return version;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <SAX/helpers/AttributesImpl.hpp>
|
||||
#include "xslt_namespace_stack.hpp"
|
||||
#include "xslt_qname.hpp"
|
||||
#include "handler/xslt_constants.hpp"
|
||||
|
||||
namespace Arabica
|
||||
{
|
||||
|
@ -137,7 +138,11 @@ public:
|
|||
if(pending_attribute_ == -1)
|
||||
return;
|
||||
|
||||
atts_.setValue(pending_attribute_, buffer_.str());
|
||||
if(atts_.getURI(pending_attribute_) == StylesheetConstant::NamespaceURI())
|
||||
atts_.removeAttribute(pending_attribute_);
|
||||
else
|
||||
atts_.setValue(pending_attribute_, buffer_.str());
|
||||
|
||||
pending_attribute_ = -1;
|
||||
} // end_attribute
|
||||
|
||||
|
@ -146,6 +151,9 @@ public:
|
|||
const std::string& qName,
|
||||
const std::string& value)
|
||||
{
|
||||
if(uri == StylesheetConstant::NamespaceURI())
|
||||
return;
|
||||
|
||||
if(!pending_element_)
|
||||
{
|
||||
std::cerr << "ERROR: Cannot write attribute, no open element" << std::endl;
|
||||
|
@ -310,6 +318,9 @@ private:
|
|||
if(n->first == "xml")
|
||||
continue;
|
||||
|
||||
if(n->second == StylesheetConstant::NamespaceURI())
|
||||
continue;
|
||||
|
||||
std::string qName = (n->first.empty()) ? "xmlns" : "xmlns:" + n->first;
|
||||
atts_.addAttribute("http://www.w3.org/2000/xmlns",
|
||||
n->first,
|
||||
|
|
Loading…
Reference in a new issue