Problem getting node children and text without the node tag

Problem getting node children and text without the node tag

Post by Sridha » Fri, 19 Apr 2002 06:00:19



Hi all,
Here is my problem. I am trying to copy all my child nodes + my text value
but I don't want my current node tag displayed.

Input XML:
<a>
    This is my text value
    <b> B text goes here </b>
    A text continues here
    <c>C comes here</c>
</a>

Output XML:
<output>
    This is my text value
    <b> B text goes here </b>
    A text continues here
    <c>C comes here</c>
</output>

This precludes me from using <xsl:copy-of> as it copies the current node tag
also. If I use <xsl:apply-templates/> It cuts out the "This is my text
value" part and goes directly to "B text goes here" and so on. Any clues on
how to do this?

Any help would be appreciated.

Thanks,
Sridhar.

 
 
 

Problem getting node children and text without the node tag

Post by Jatin Bhat » Fri, 19 Apr 2002 07:36:22


Hi all,
Here is my problem. I am trying to copy all my child nodes + my text value
but I don't want my current node tag displayed.

Input XML:
<a>
    This is my text value
    <b> B text goes here </b>
    A text continues here
    <c>C comes here</c>
</a>

Output XML:
<output>
    This is my text value
    <b> B text goes here </b>
    A text continues here
    <c>C comes here</c>
</output>

This precludes me from using <xsl:copy-of> as it copies the current node tag
also. If I use <xsl:apply-templates/> It cuts out the "This is my text
value" part and goes directly to "B text goes here" and so on. Any clues on
how to do this?

Any help would be appreciated.

Thanks,
Jatin.

 
 
 

Problem getting node children and text without the node tag

Post by Dave Berto » Fri, 19 Apr 2002 13:13:15



> Hi all,
> Here is my problem. I am trying to copy all my child nodes + my text value
> but I don't want my current node tag displayed.

...

The "text value" of an element is also any number of text node
children.

Try:

<xsl:copy-of select="node()"/>

This assumes you want a deep copy of any element children.  I couldn't
tell from your description of the problem if that's the case or not.

Dave

 
 
 

Problem getting node children and text without the node tag

Post by Sridha » Sun, 21 Apr 2002 05:24:53


It is. Your solution solved it.

Thanks, Dave.
Sridhar.



Quote:> > Hi all,
> > Here is my problem. I am trying to copy all my child nodes + my text
value
> > but I don't want my current node tag displayed.

> ...

> The "text value" of an element is also any number of text node
> children.

> Try:

> <xsl:copy-of select="node()"/>

> This assumes you want a deep copy of any element children.  I couldn't
> tell from your description of the problem if that's the case or not.

> Dave

 
 
 

1. Getting Nodes without the childs

Hi All,

I need to build another XML doc from a list of XMLs, and depending on
each node attribute from the XML tree I'll be plucking them one by
one... however, I would also need to compare the root/element (which
usually is only one for this XMLs) of all the XMLs and create a
root/element... I usually do this by taking the first XML and appending
the other XML's nodes to the first XML...

What I need to know is how to get the root/element without the child?
example:

<ISSUE>
<ARTICLE>
</ARTICLE>
</ISSUE>

I would want to just get the ISSUE without the article, and then
depending on the article's attribute, I would be populating the XML
docs (with the common issue/attributes)...

I'm using xml.documentelement.selectnodes("/ISSUE") to get the issue
node.. but it includes the articles inside...

help!

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Dual Boot Problem Win2k Win98

3. How to get Value-Of current node without Value-Of children's nodes?

4. HP4V Printer Experiences

5. child nodes include artificial text nodes !!!!

6. fsdb and cpp

7. Node with text vs node with child element

8. Help, please - inserting data into LONG RAW

9. copy a node's text and children, but not the node itself

10. Child Nodes's Child Node creation

11. Problem with Replacing a Text child node

12. Text node or no Text node

13. accessing the text bit of an element without the text of a child?