Resolved cdata-section-element names so that unprefixed names are in the default namespace. Merge multiple xsl:output/@cdata-section-elements

This commit is contained in:
jez 2009-04-07 13:39:31 +01:00
parent b70e521d79
commit 62b24c144d
6 changed files with 22 additions and 3 deletions

View file

@ -64,13 +64,16 @@ private:
{
Output::CDATAElements elements;
if(cdata_section_elements.empty())
return elements;
std::istringstream is(cdata_section_elements);
while(!is.eof())
{
std::string e;
is >> e;
XML::QualifiedName<std::string> qualifiedName = context_.processInternalQName(e);
XML::QualifiedName<std::string> qualifiedName = context_.processElementQName(e);
elements.insert(QName::create(qualifiedName));
} // while

View file

@ -59,6 +59,11 @@ public:
Arabica::XPath::XPathExpressionPtr<std::string> xpath_attribute_value_template(const std::string& expr) const { return xpath_.compile_attribute_value_template(expr); }
CompiledStylesheet& stylesheet() const { return stylesheet_; }
XML::QualifiedName<std::string> processElementQName(const std::string& qName) const
{
return parser_.processElementQName(qName);
} // processElementQName
XML::QualifiedName<std::string> processInternalQName(const std::string& qName) const
{
return parser_.processInternalQName(qName);

View file

@ -131,7 +131,7 @@ public:
void output_settings(const Output::Settings& settings, const Output::CDATAElements& cdata_elements)
{
output_settings_ = settings;
output_cdata_elements_ = cdata_elements;
output_cdata_elements_.insert(cdata_elements.begin(), cdata_elements.end());
} // output_settings
void prepare()

View file

@ -334,6 +334,8 @@ private:
bool isCDATA()
{
if(element_stack_.empty())
return false;
QName currentElement = element_stack_.top();
return cdataElements_.find(currentElement) != cdataElements_.end();
} // isCDATA

View file

@ -83,6 +83,7 @@ public:
StreamSink(std::ostream& stream) :
stream_(stream),
disable_output_escaping_(false),
in_cdata_(false),
seen_root_(true),
out_again_(false),
indent_(-1),
@ -164,7 +165,7 @@ protected:
{
close_element_if_empty();
if(!disable_output_escaping_)
if(!disable_output_escaping_ && !in_cdata_)
std::for_each(ch.begin(), ch.end(), Arabica::XML::text_escaper<char>(stream_));
else
stream_ << ch;
@ -174,11 +175,13 @@ protected:
{
close_element_if_empty();
in_cdata_ = true;
stream_ << "<![CDATA[";
} // do_start_CDATA
void do_end_CDATA()
{
in_cdata_ = false;
stream_ << "]]>";
} // do_end_CDATA
@ -299,6 +302,7 @@ private:
std::ostream& stream_;
bool disable_output_escaping_;
bool in_cdata_;
bool empty_;
bool seen_root_;
Settings settings_;

View file

@ -41,6 +41,11 @@ public:
return namespace_tracker_.getURI(prefix);
} // namespaceURI
XML::QualifiedName<std::string> processElementQName(const std::string& rawName) const
{
return namespace_tracker_.processElementName(rawName);
} // processElementQName
XML::QualifiedName<std::string> processInternalQName(const std::string& rawName) const
{
return namespace_tracker_.processName(rawName);