473,770 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XSLT: looking help with XPath-expression

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
Jul 20 '05 #1
4 1293
In article <42********@e-post.inode.at>,
Gerald Aichholzer <ga**@sbox.tugr az.at> wrote:
<!-- 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
Jul 20 '05 #2


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/*/@*

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 20 '05 #3
Martin Honnen wrote:


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/*/@*


Thank you, Martin.

Gerald
Jul 20 '05 #4
In article <42********@e-post.inode.at>,
Gerald Aichholzer <ga**@sbox.tugr az.at> wrote:
<plugin>
<icon></icon>
<!-- some elements here -->
<object>
<!-- some elements here -->
</object>
</plugin>
plugin/object/* | plugin/object/@* | plugin/object/*/@*
Thank you, Martin.


That doesn't do what your example shows, but maybe it does what you
want.

-- Richard
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1704
by: Bill Sneddon | last post by:
Does anyone on this site have an informed guess as to when the standards XSLT 2.0 and XPATH 2.0 will be publish and how long it will take for the common processor will support them?
4
21210
by: Son KwonNam | last post by:
In XSLT, is this possible to get value from xml using XPath which is in XSLT variable? I mean XPath strings can be dynamic while XSL Transforming. If possible, How?? Because I'm not a native English speaker, it's quite hard to make the problem clear. Please see the following example.
1
2932
by: Rhino | last post by:
Can anyone point me to a good free XSLT Tutorial online? I looked for some a few months ago and didn't find anything very good. I'm hoping some of the experts here can point me to a good XSLT tutorial..... -- Rhino --- rhino1 AT sympatico DOT ca "There are two ways of constructing a software design. One way is to make it
4
1305
by: Michael Kragh Pedersen | last post by:
Is it not possible to use ?: in your group expressions in XSLT patterns, like it is for example in JavaScript? Michael K. P.
0
380
by: Jay Allard | last post by:
Hello I posted this in the vb.net group on the 2/25/2004, but didn't get any response. Here's attempt 2. Does anyone know of a more appropriate place to post this? One new piece of information: It fails on any method that it happens to hit first. I juggled the methods a bit, and it just doesn't matter. As soon as the XslTransform hits an extension function, it fails with an invalid argument exception.
1
1483
by: Sonu Kapoor | last post by:
Hi, I would like to use xpath with xslt. I know that this should be possible, but I dont get it ! Here is what I have tried so far: ==================================== my xml file: ====================================
3
3092
by: Ian Roddis | last post by:
Hello, I want to embed SQL type queries within an XML data record. The XML looks something like this: <DISPLAYPAGE> <FIELD NAME="SERVER" TYPE="DROPDOWN"> <OPTION>1<OPTION> <OPTION>2<OPTION> <OPTION>3<OPTION> </FIELD>
3
1917
by: Greg | last post by:
Hi, I want to create a web based interface that uses a form + Javascript (in an XHTML namespace) to construct an XPath to query and modify the attributes of some SVG (in an SVG namespace). There are lots of Google hits on each of these specifications and related technology, shuch as namespaces but there's almost nothing I can find that shows useful examples of the different ways they might be combined?
2
22779
jkmyoung
by: jkmyoung | last post by:
Here's a short list of useful xslt general tricks that aren't taught at w3schools. Attribute Value Template Official W3C explanation and example This is when you want to put dynamic values in the attribute of an element. Instead of using the <xsl:attribute> element, you can simply place the xpath in the attribute itself. The most common usage of this is in creating hyperlinks.
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10101
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.