XPATH expression TextIndexed

Post Reply
JuBaz
Member
Posts: 30
Joined: Tue Dec 07, 2021 11:41 am

XPATH expression TextIndexed

Post by JuBaz »

Hi all,
I have a xml file with multiple order positions which may be send to the customer from different locations. I now want to know, whats the weight of the packages, but just for the positions which will be send out from the shipping location = luc_inhouse and not for the others. I've already tried something like this //position[./productShippingLocation = luc_inhouse]/weight but I didn't get any result.

xml structur see below.

Thanks in advance and regards, Julia

</position>
<position>
<netPrice>2.900</netPrice>
<grossPrice/>
<vat>19.0</vat>
<amount>2</amount>
<totalQuantity>2</totalQuantity>
<productShippingLocation>b7</productShippingLocation>
<product>
<internalId>172822</internalId>
<externalId>GMC-GA-10000227-10</externalId>
<productName>Einkaufswagenlöser</productName>
<productDescription>aus Metall incl. angebrachtem Schlüsselring </productDescription>
<packingUnit>T_PCS</packingUnit>
<packingQuantity>1</packingQuantity>
<weight>12</weight>
<productCatalog></productCatalog>
<productCategory>stock</productCategory>
<propertyFormat>6,5 x 2,5 cm </propertyFormat>
<propertyCoverage/>
<propertyPrint/>
<propertyConditioning/>
<propertyPaper/>
<propertyProcessing/>
</product>
</position>
</position>
<position>
<netPrice>4.750</netPrice>
<grossPrice/>
<vat>19.0</vat>
<amount>1</amount>
<totalQuantity>1</totalQuantity>
<productShippingLocation>luc_inhouse</productShippingLocation>
<product>
<internalId>9876</internalId>
<externalId>5432</externalId>
<productName>Schild</productName>
<productDescription>Name</productDescription>
<packingUnit>T_PCS</packingUnit>
<packingQuantity>1</packingQuantity>
<weight>25</weight>
<productCatalog>Namensschild</productCatalog>
<productCategory>vdp</productCategory>
<propertyFormat>6,5 x 3,5 cm</propertyFormat>
<propertyCoverage>2-seitig</propertyCoverage>
<propertyPrint>Lasergravur</propertyPrint>
<propertyConditioning/>
<propertyPaper>Aluminium</propertyPaper>
<propertyProcessing>Verpacken, magentischen Clip hinzufügen</propertyProcessing>
</product>
</position>
mkayyyy
Member
Posts: 104
Joined: Mon Nov 21, 2016 6:31 pm
Location: UK

Re: XPATH expression TextIndexed

Post by mkayyyy »

Your XPath expression should be this:

Code: Select all

//position[productShippingLocation='luc_inhouse']/product/weight
It was missing quotes around 'luc_inhouse' and /product/weight
Last edited by mkayyyy on Fri Feb 27, 2026 12:42 pm, edited 1 time in total.
JuBaz
Member
Posts: 30
Joined: Tue Dec 07, 2021 11:41 am

Re: XPATH expression TextIndexed

Post by JuBaz »

Sometimes it's that easy, thank you!
mkayyyy
Member
Posts: 104
Joined: Mon Nov 21, 2016 6:31 pm
Location: UK

Re: XPATH expression TextIndexed

Post by mkayyyy »

No worries! Glad I could help
Post Reply