Which version of XPath is installed
Asked Answered
B

2

6

I'm using powerShell, and I want to use lower-case() in a XPath.Something like that

//Machines/Machine[lower-case(@FQDN)=lower-case('machine2.mydomain.com')]

The documentation indicate that I need XPath 2.0, how can I check the version of XPath installed on my server?

Bechuanaland answered 22/7, 2014 at 18:42 Comment(3)
Not sure if i understand your question but are you just looking for lowercase in powershell? On any string you can user .ToLower() for example "IDONTKNOWWHATWEREYELLINGABOUT".ToLower() would return idontknowwhatwereyellingabout. Not sure about the Xpath part of the question?Glyptography
I found this in regards to checking xpath version: #7952379. The higest rated answer in the second paragraph.Glyptography
The xpath used with windows event logs is even more crippled.Toehold
E
7

As of 2012, Microsoft was officially not supporting XPath 2.0 in the .NET Framework (which is what you'll be using from PowerShell, unless you pull in a 3rd-party library) and as recently as last year it was still not happening. Given that they said a decade ago that they weren't going to implement it, and it hasn't happened yet - don't count on it ever happening.

See XPath and XSLT 2.0 for .NET? for alternatives.

Endometriosis answered 22/7, 2014 at 21:11 Comment(0)
T
0

You could do it in powershell without worrying about case:

$xml = [xml](get-content file.xml)                                     
$xml.machines.machine | ? fqdn -eq machine2.mydomain.com


FQDN
----
machine2.mydomain.com
Toehold answered 22/2, 2020 at 19:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.