xsl-list
[Top] [All Lists]

Re: [xsl] xpath query failing

2016-04-22 17:35:27
All your elements are in a namespace, so all the names need to be subjected to 
the same treatment:

"/*[local-name()='nlog']/*[local-name()='rules'/*[local-name()='logger'][@writeTo='file']/@minlevel"

You example missed the "@" from "@writeTo".

Michael Kay
Saxonica


On 22 Apr 2016, at 22:21, Joseph L. Casale 
jcasale(_at_)activenetwerx(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Well, there's always the ghastly workaround

"/*[local-name() = 'nlog']/@throwExceptions"

Over on xml-dev there are people actually defending the design of XML 
namespaces. Amazing.

Hi Michael,
That worked, much appreciated. I assumed I could leverage that for the 
remainder
as well such as selecting "/nlog/targets/target[@name='file']/@fileName" or
"/nlog/rules/logger[writeTo='file']/@minlevel" however those did not work with
either the above workaround or a relative expression such as 
"//targets/target[@name='file']/@fileName".

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd";
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     throwExceptions="true">

 <targets>
   <target xsi:type="EventLog"
           name="eventLog"
           source="..."
           layout="..." />
   <target xsi:type="File"
           name="file"
           layout="..."
           fileName="..."
           archiveFileName="...{#}.log"
           archiveEvery="Day"
           archiveNumbering="Rolling"
           maxArchiveFiles="31"
           keepFileOpen="true" />
 </targets>

 <rules>
   <logger name="*" minlevel="Error" writeTo="eventLog" />
   <logger name="*" minlevel="Trace" writeTo="file" />
 </rules>
</nlog>

By chance any other tricks up your sleeve?

Thanks!
jlc

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>