Peter,

Thanks for the suggestions. Unfortunately I get the
same results with the code you suggested as I was 
getting before. A little more background:

- I am building a web clipping/transcoding service.

- The service takes a target URL, fetches the
associated document, runs it through jTidy to turn it
into XHTML and then uses Xalan/XSL to clip parts of
the fetched document into what is ultimately served to

the client (a small footprint mobile device).

- Once a subset of the target page is identified, you
typically want to copy that node and its children,
perhaps with some modifications. That's why I am 
interested in XSL code for copying elements and 
attributes.

- What is happing is that the code to copy elements
and their attributes is picking up one attribute of
the source element, and then mysteriously adding some
others! For example, when copying a form element, it
copies the action attribute but not the name or other
attributes and it adds attributes that were not in the
source document at all!

Could this have something to do with having the output
method be html?

Baffled,

-Chris.

--- Peter Davis <[EMAIL PROTECTED]> wrote:
> I'm not sure why that wouldn't work, but here's the
> identity template I use 
> in my stylesheets:
> 
> <xsl:template match="node() | @*">
>     <xsl:copy>
>         <xsl:apply-templates select="node() | @*"/>
>     </xsl:copy>
> </xsl:template>
> 
> This was taken from the XSLT specification, it's
> called the "identity" 
> template.  Like I said, I don't know why yours
> didn't work, but I've used 
> this one with Xalan before.
> 
> On Monday 11 February 2002 05:22, Raber Chris wrote:
> > I am trying to write a block of XSL to copy
> elements
> > and their attributes. The code is:
> >
> >     <xsl:template match="*">
> >             <xsl:copy>
> >                     <xsl:copy-of select="@*"/>
> >                     <xsl:apply-templates/>
> >             </xsl:copy>
> >     </xsl:template>
> >
> > It kind of works but not all attributes are
> > consistently copied. Is this a Xalan bug or is
> there
> > something wrong with this XSL code?
> >
> > TIA,
> >
> > -Chris.
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Send FREE Valentine eCards with Yahoo! Greetings!
> > http://greetings.yahoo.com
> 
> -- 
> Peter Davis
> Almost anything derogatory you could say about
> today's software design
> would be accurate.
>               -- K.E. Iverson


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

Reply via email to