ArrayList attrs;
XmlQualifiedName [] useAttributeSets;
Hashtable nsDecls;
- bool requireNameFix;
- XPathNavigator stylesheetNode;
- XslStylesheet stylesheet;
public XslLiteralElement (Compiler c) : base (c) {}
public XslLiteralAttribute (Compiler c)
{
this.prefix = c.Input.Prefix;
- this.nsUri = c.Input.NamespaceURI;
+ if (prefix.Length > 0) {
+ string alias =
+ c.CurrentStylesheet.GetActualPrefix (prefix);
+ if (alias != prefix) {
+ prefix = alias;
+ XPathNavigator clone = c.Input.Clone ();
+ clone.MoveToParent ();
+ nsUri = clone.GetNamespace (alias);
+ }
+ else
+ nsUri = c.Input.NamespaceURI;
+ }
+ else
+ nsUri = String.Empty;
this.localname = c.Input.LocalName;
this.val = new XslAvt (c.Input.Value, c);
}
protected override void Compile (Compiler c)
{
- requireNameFix = true;
- stylesheetNode = c.Input.Clone ();
- stylesheet = c.CurrentStylesheet;
+ prefix = c.Input.Prefix;
+ string alias = c.CurrentStylesheet.GetActualPrefix (prefix);
+ if (alias != prefix) {
+ prefix = alias;
+ nsUri = c.Input.GetNamespace (alias);
+ }
+ else
+ nsUri = c.Input.NamespaceURI;
this.localname = c.Input.LocalName;
this.useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets", XsltNamespace);
c.Input.MoveToParent ();
}
- private void GetCorrectNames ()
- {
- requireNameFix = false;
- prefix = stylesheetNode.Prefix;
- string alias = stylesheet.PrefixInEffect (prefix, null);
- if (alias != null && alias != stylesheetNode.Prefix) {
- nsUri = stylesheetNode.GetNamespace (alias);
- if (alias != null)
- prefix = alias;
- }
- else
- nsUri = stylesheetNode.NamespaceURI;
-
- }
-
public override void Evaluate (XslTransformProcessor p)
{
// Since namespace-alias might be determined after compilation
// of import-ing stylesheets, this must be determined later.
- if (requireNameFix)
- GetCorrectNames ();
-
bool isCData = p.InsideCDataElement;
p.PushElementState (prefix, localname, nsUri, true);
p.Out.WriteStartElement (prefix, localname, nsUri);