XSLT: looking help with XPath-expression

G

Gerald Aichholzer

Hello NG,

I have a XML file looking like:

<!-- some elements here -->
<plugin>
<icon></icon>
<!-- some elements here -->
<object>
<!-- some elements here -->
</object>
<symbol>
<!-- some elements here -->
</symbol>
</plugin>


and I am looking for an XPath-Expression which selects
the following fragment (including attributes if present):

<plugin>
<icon></icon>
<!-- some elements here -->
<object>
<!-- some elements here -->
</object>
</plugin>

I know that I can select

. the attributes of <plugin> using
plugin/@*

. object and all subelements with attributes using
plugin/object/*|plugin/object/@*

. but how can I add only the direct childs of objects
with attributes?


thanx in advance,
Gerald
 
R

Richard Tobin

Gerald Aichholzer said:
<!-- some elements here -->
<plugin>
<icon></icon>
<!-- some elements here -->
<object>
<!-- some elements here -->
</object>
<symbol>
<!-- some elements here -->
</symbol>
</plugin>
and I am looking for an XPath-Expression which selects
the following fragment (including attributes if present):

<plugin>
<icon></icon>
<!-- some elements here -->
<object>
<!-- some elements here -->
</object>
</plugin>

You can't do that. XPath can only return nodes that are in the
original document, and you want a modified version of the <plugin>
element that only has some of the original children.

-- Richard
 
M

Martin Honnen

Gerald Aichholzer wrote:

I have a XML file looking like:

<!-- some elements here -->
<plugin>
<icon></icon>
<!-- some elements here -->
<object>
<!-- some elements here -->
</object>
<symbol>
<!-- some elements here -->
</symbol>
</plugin>


and I am looking for an XPath-Expression which selects
the following fragment (including attributes if present):

<plugin>
<icon></icon>
<!-- some elements here -->
<object>
<!-- some elements here -->
</object>
</plugin>

I know that I can select

. the attributes of <plugin> using
plugin/@*

. object and all subelements with attributes using
plugin/object/*|plugin/object/@*

. but how can I add only the direct childs of objects
with attributes?

plugin/object/* | plugin/object/@* | plugin/object/*/@*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,247
Members
46,844
Latest member
JudyGvh32

Latest Threads

Top