Yes, I think you found the solution. There are some variants, assuming XPointer can handle the XPath - but they aren't really much different from what you have.
/bbc:*/bbc:media/(* except bbc:images)
/bbc:*/bbc:media/*[ not(node-name(.) = (xs:QName('bbc:images'))) ]
From what I know about XPointer it wasn't really designed for this sort of
node-level surgery. The idea is usually to point at a node, without rewriting
its contents. A cleaner-looking approach might be to point to the whole node,
but rewrite the results with a later XSLT or XQuery typeswitch. Of course that
adds its own sort of complexity, and might end up being slower, too.
-- Mike
On 26 Oct 2012, at 08:31 , Jonathan Cook <[email protected]> wrote:
> Hmmmm, I tried those and also tried using descendent but neither work?
>
> I think my only solution is to use:
> /bbc:*/bbc:media/*[not(self::bbc:images)]
>
> And wrap the result in media tags which isn't very neat unfortunately.
>
> Thanks
> Jon
>
>
> On 26/10/2012 16:24, "Jakob Fix" <[email protected]> wrote:
>
>> Hi Jon,
>>
>>
>> /bbc:*/bbc:media[not(.//bbc:images)] should exclude all descendants
>> called bbc:images of bbc:media;
>>
>> if you only wanted to exclude direct children you'd use
>> /bbc:*/bbc:media[not(./bbc:images)]
>>
>> cheers,
>> Jakob.
>>
>>
>>
>> On Fri, Oct 26, 2012 at 5:03 PM, Jonathan Cook <[email protected]>
>> wrote:
>>> Thanks,
>>>
>>> And if I wanted to exclude an element under media I had a play with..
>>> /bbc:*/bbc:media[not(child::bbc:images)]
>>>
>>> And
>>> /bbc:*/bbc:media[not(/bbc:images)]
>>>
>>> And
>>> /bbc:*/bbc:media[not(*/bbc:images)]
>>>
>>> And
>>> /bbc:*/bbc:media[not(bbc:images)]
>>>
>>> Not quite right though?
>>>
>>> Thanks
>>> Jon
>>>
>>> On 26/10/2012 14:13, "Michael Blakeley" <[email protected]> wrote:
>>>
>>>> The XPath looks simple enough: try removing the final '/*' step. That step
>>>> causes the XPath to descend from bbc:media and match its element children.
>>>>
>>>> /bbc:*/bbc:media/*
>>>> vs
>>>> /bbc:*/bbc:media
>>>>
>>>> -- Mike
>>>>
>>>> On 26 Oct 2012, at 05:29 , Jonathan Cook <[email protected]> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Might be more an xpath questions but if I have the following xpointer..
>>>>>
>>>>> <xi:include
>>>>> href="http://www.bbc.co.uk/asset/39166d27-7f67-c643-9248-499ca2b3b14d"
>>>>> xpointer="xmlns(bbc=http://www.bbc.co.uk/asset)
>>>>> xpointer(/bbc:*/bbc:media/*)">
>>>>> <xi:fallback>
>>>>> <warn>Unable to resolve XInclude for
>>>>> href="http://www.bbc.co.uk/asset/39166d27-7f67-c643-9248-499ca2b3b14d"
>>>>> xpointer="xmlns(bbc=http://www.bbc.co.uk/asset)
>>>>> xpointer(/bbc:*/bbc:media/*)"
>>>>> [Asset ID=19781921]</warn>
>>>>> </xi:fallback>
>>>>> </xi:include>
>>>>>
>>>>> In the Xpointer declaration currently everything under /bbc:media is
>>>>> included
>>>>> when the xinclude is resolved, Is there a way to include the media node
>>>>> as
>>>>> well?
>>>>>
>>>>> Thanks
>>>>> Jon
>>>>>
>>>>>
>>>>> http://www.bbc.co.uk
>>>>> This e-mail (and any attachments) is confidential and may contain personal
>>>>> views which are not the views of the BBC unless specifically stated.
>>>>> If you have received it in error, please delete it from your system.
>>>>> Do not use, copy or disclose the information in any way nor act in
>>>>> reliance
>>>>> on it and notify the sender immediately.
>>>>> Please note that the BBC monitors e-mails sent or received.
>>>>> Further communication will signify your consent to this.
>>>>> _______________________________________________
>>>>> General mailing list
>>>>> [email protected]
>>>>> http://developer.marklogic.com/mailman/listinfo/general
>>>>
>>>> _______________________________________________
>>>> General mailing list
>>>> [email protected]
>>>> http://developer.marklogic.com/mailman/listinfo/general
>>>
>>>
>>> http://www.bbc.co.uk/
>>> This e-mail (and any attachments) is confidential and may contain personal
>>> views which are not the views of the BBC unless specifically stated.
>>> If you have received it in error, please delete it from your system.
>>> Do not use, copy or disclose the information in any way nor act in reliance
>>> on it and notify the sender immediately.
>>> Please note that the BBC monitors e-mails sent or received.
>>> Further communication will signify your consent to this.
>>>
>>> _______________________________________________
>>> General mailing list
>>> [email protected]
>>> http://developer.marklogic.com/mailman/listinfo/general
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>
>
> http://www.bbc.co.uk/
> This e-mail (and any attachments) is confidential and may contain personal
> views which are not the views of the BBC unless specifically stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in reliance
> on it and notify the sender immediately.
> Please note that the BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
