cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Boag/CAM/Lotus" <>
Subject Re: [C2] [Xalan2] extract "xmlns:" tags from XSL
Date Thu, 05 Oct 2000 13:49:28 GMT

Hmm... you want to go through the TrAX interfaces for this?

Do you need these at parse time, or way after the fact?


                    Srinivas             To:               
                    <dims@yahoo.c        cc:,
                    om>                  Subject:     Re: [C2] [Xalan2] extract "xmlns:"
tags from XSL             
                    08:37 AM                                                             
                    respond to                                                           


We need to get a list of xmlns attributes that are specified in the .XSL
files. I don't see a easy
way to extract it from a trax.Templates instance. I definitely know that
trax.Templates is nothing
but a org.apache.xalan.templates.StylesheetRoot. But am unable to get the
info. Here's the code
that i tried. It throws exception in getDocumentElement. Please let us know
how to do this.


Vector vector = new Vector();
StylesheetRoot stylesheet = (StylesheetRoot)templates;
int n = stylesheet.getGlobalImportCount();
for(int j = 0; j < n; j++)
  Stylesheet imported = stylesheet.getGlobalImport(j);
  Element element = imported.getDocumentElement();
  NamedNodeMap map = element.getAttributes();
  int attrCount = map.getLength();
  for (int i = 0; i < attrCount; i++)
    Attr attr = (Attr) map.item(i);
    String attrName = attr.getName();
    if (
     !attrName.equals("xmlns:xsl") &&
         (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
    ) {
      String[] pair = new String[2];
      pair[0] = attrName;
      pair[1] = attr.getValue();

Do You Yahoo!?
Yahoo! Photos - 35mm Quality Prints, Now Get 15 Free!

View raw message