xsl-list
[Top] [All Lists]

RE: Problems copying elements recursively.

2003-02-06 17:42:41
Thanks Tom. I am sorry I was not very clear in the
question. It is true that I am trying to display the
angle brackets, etc. Here is what i am doing: I am
transforming the nodetree into a table to display as
html. However, I am also trying to show the raw xml
for a particular node and all its decendants. The
problem is that the templates i am using does not
traverse the tree recursively. it only shows the node
and its immediate children...maybe my xpath statement
is incorrect. 

--- "Passin, Tom" <tpassin(_at_)mitretek(_dot_)org> wrote:
[ Imrran Wahid ]

I've been trying with this piece for a while but
still
cannot get it right.

I am trying to copy a certain node-tree from the
xml
document via xsl style sheet. Basically i would
like
the output to be an xml representation of the node
tree.


1)  If you just want to copy it, just use
xsl:copy-of to copy the whole
nodeset of interest.

2) It appears you are trying to build up elements by
inserting "<" and
">" signs (example: "<xsl:text></</xsl:text>").  DO
NOT EVEN THINK OF
DOING THIS.  Plus, you do not need to do it since
xslt will do what you
want (but you have to explain it clearly first). 
With xslt, you build a
tree first, and then the angle brackets get put in
by the serializer
when you serialize the tree to the output.  Attempts
to circumvent this
process will tend to get you in trouble, and even
when they work lead to
misunderstanding of how the xslt system is designed
to work. (Look in
the FAQs for "disable-output-escaping" for more on
this).

If you want to create an element with a name
extracted from the source,
you can use xsl:element or, if you already know the
name, just write the
whole element with literal tags:

<name1><xsl:value-of select='theContent'/></name1>

for example.

Cheers,

Tom P
 

 XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list



__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list