what is this meaning of this xquery?

  • Hi,

    with reference to http://technet.microsoft.com/en-us/library/ms190687.aspx

    originally the query is

    SELECT CatalogDescription.query('

    declare namespace PD="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription";

    /child::PD:ProductDescription/child::PD:Features/parent::PD:ProductDescription/child::PD:Summary

    ')

    FROM Production.ProductModel

    WHERE ProductModelID=19

    and it was suggested to change the above xquery to

    /child::PD:ProductDescription[child::PD:Features]/child::PD:Summary

    both query returns

    <PD:Summary xmlns:PD="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ProductModelDescription">

    <p1:p xmlns:p1="http://www.w3.org/1999/xhtml">Our top-of-the-line competition mountain bike.

    Performance-enhancing options include the innovative HL Frame,

    super-smooth front suspension, and traction for all terrain.

    </p1:p>

    </PD:Summary>

    what does /child::PD:ProductDescription[child::PD:Features]/child::PD:Summary means.

    even after studying http://technet.microsoft.com/en-us/library/ms177470.aspx, I still could not figure out what the above query is trying to achieve?

    thanks

  • It's looking for ProductDescription nodes that have one or more features nodes as children. For those ProductDescription nodes it returns the content of the Summary element.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply