private PrefixQName qname; // When we not have AVTs at all we can do this. null otherwise. private static PrefixQName CreateAttributeQName(string name, string nsUri, InputScopeManager manager) { // if name == "xmlns" we don't need to generate this attribute. // to avoid i'ts generation we can return false and not add AtributeCation to it's parent container action // for now not creating this.qname will do the trick at execution time if (name == Keywords.s_Xmlns) return null; if (nsUri == Keywords.s_XmlnsNamespace) { throw new XsltException(Res.Xslt_ReservedNS, nsUri); } PrefixQName qname = new PrefixQName(); qname.SetQName(name); qname.Namespace = nsUri != null ? nsUri : manager.ResolveXPathNamespace(qname.Prefix); if(qname.Prefix.StartsWith("xml")) { if( qname.Prefix.Length == 3 && qname.Namespace == Keywords.s_XmlNamespace && (qname.Name == "lang" || qname.Name == "space") ) { // preserve prefix for xml:lang and xml:space } else if (qname.Prefix == Keywords.s_Xmlns && nsUri == null) { // if NS wasn't specified we have to use prefix to find it and this is imposible for 'xmlns' throw new XsltException(Res.Xslt_InvalidPrefix, qname.Prefix); } else { qname.ClearPrefix(); } } return qname; }
private PrefixQName qname; // When we not have AVTs at all we can do this. null otherwise. private static PrefixQName CreateAttributeQName(string name, string nsUri, InputScopeManager manager) { // if name == "xmlns" we don't need to generate this attribute. // to avoid i'ts generation we can return false and not add AtributeCation to it's parent container action // for now not creating this.qname will do the trick at execution time if (name == Keywords.s_Xmlns) { return(null); } if (nsUri == Keywords.s_XmlnsNamespace) { throw new XsltException(Res.Xslt_ReservedNS, nsUri); } PrefixQName qname = new PrefixQName(); qname.SetQName(name); qname.Namespace = nsUri != null ? nsUri : manager.ResolveXPathNamespace(qname.Prefix); if (qname.Prefix.StartsWith("xml")) { if (qname.Prefix.Length == 3) // prefix == "xml" { if (qname.Namespace == Keywords.s_XmlNamespace && (qname.Name == "lang" || qname.Name == "space")) { // preserve prefix for xml:lang and xml:space } else { qname.ClearPrefix(); } } else if (qname.Prefix == Keywords.s_Xmlns) { if (qname.Namespace == Keywords.s_XmlnsNamespace) { // if NS wasn't specified we have to use prefix to find it and this is imposible for 'xmlns' throw new XsltException(Res.Xslt_InvalidPrefix, qname.Prefix); } else { qname.ClearPrefix(); } } } return(qname); }
private static PrefixQName CreateElementQName(string name, string nsUri, InputScopeManager manager) { if (nsUri == Keywords.s_XmlnsNamespace) { throw new XsltException(Res.Xslt_ReservedNS, nsUri); } PrefixQName qname = new PrefixQName(); qname.SetQName(name); if (nsUri == null) { qname.Namespace = manager.ResolveXmlNamespace(qname.Prefix); } else { qname.Namespace = nsUri; } return qname; }
private static PrefixQName CreateElementQName(string name, string nsUri, InputScopeManager manager) { if (nsUri == Keywords.s_XmlnsNamespace) { throw new XsltException(Res.Xslt_ReservedNS, nsUri); } PrefixQName qname = new PrefixQName(); qname.SetQName(name); if (nsUri == null) { qname.Namespace = manager.ResolveXmlNamespace(qname.Prefix); } else { qname.Namespace = nsUri; } return(qname); }