Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to copy a parent Tag/Attributes only...

Status
Not open for further replies.

MDean

Programmer
Oct 29, 2002
2
US
Hi All,

I am conditionally copying sections of an xml document, as is, to another xml document, depending on a parameter passed into the XSLT. Specifically, my source document looks like this:
<SCREEN>
<PANEL NAME=&quot;mainPanel&quot;>
<TABBEDPANE NAME=&quot;tabbedPane&quot;>
<PANEL NAME=&quot;generalPanel&quot;>
.......
</PANEL>
<PANEL NAME=&quot;userPanel&quot;>
.......
</PANEL>
<PANEL NAME=&quot;rightsPanel&quot;>
.......
</PANEL>
</TABBEDPANE>
</PANEL>
</SCREEN>
I have been able to get my conditions to work, which will copy the respective child (PANEL) elements depending on my parameter. What I haven't been able to get to work is the XSL that would ONLY copy the <PANEL NAME=&quot;mainPanel&quot;> and the <TABBEDPANE NAME=&quot;tabbedPane&quot;> tags. I was able to find some code which at least outputs the 2 tags, however it treats them as empty tags and places the &quot;/>&quot; at the end of each. So I end up with code like the following:
<PANEL NAME=&quot;mainPanel&quot;/>
<TABBEDPANE NAME=&quot;tabbedPane&quot;/>
<PANEL NAME=&quot;generalPanel&quot;>
......
</PANEL>
</TABBEDPANE>
</PANEL>

Instead of the desired:
<PANEL NAME=&quot;mainPanel&quot;>
<TABBEDPANE NAME=&quot;tabbedPane&quot;>
<PANEL NAME=&quot;generalPanel&quot;>
......
</PANEL>
</TABBEDPANE>
</PANEL>

Thanks for any help!
 
Thanks to everyone who may have read this post and tossing it around in the mind. I figured out what I needed to do to have it produce the results that I neede.

Again, thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top