Re: Aw: Re: [xsl] Trying to Extract a node with matching attribute value with xsltproc

Subject: Re: Aw: Re: [xsl] Trying to Extract a node with matching attribute value with xsltproc
From: "ohaya ohaya@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 25 Mar 2024 01:41:16 -0000
 Martin (et al),
That (changing to xsl:copy-of) did the trick!!
Thanks!!
Jim


    On Sunday, March 24, 2024 at 04:35:35 AM EDT, Martin Honnen
<martin.honnen@xxxxxx> wrote:

 You need xsl:copy-of, not xsl:value-of, if you want to output the full node.
But if there is some default namespace declaration the suggested XPath
expression might not select anything.

--
Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.Am
24.03.24, 01:35 schrieb "ohaya ohaya@xxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>:
    I tried the XSL that Liam suggested, but it isn't finding anything
:(....B  Below is the xsltproc run with -v:
    -bash-4.4$ xsltproc -v mulberry.xsl configfile.xml
creating dictionary for stylesheet
reusing dictionary from mulberry.xsl for stylesheet
xsltParseStylesheetProcess : found stylesheet
xsltPreprocessStylesheet: removing ignorable blank node
xsltCompilePattern : parsing '/'
xsltCompilePattern : parsed /, default priority 0.500000
added pattern : '/' priority 0.500000
parsed 1 templates
Resolving attribute sets references
Creating sub-dictionary from stylesheet for transformation
Registered 0 modules
reusing transformation dict for output
Registering global variables
Registering global variables from mulberry.xsl
xsltProcessOneNode: applying template '/' for /
xsltValueOf: select //Setting[@Name = 'TheOneIWant']
xsltValueOf: result ''
freeing transformation dictionary
freeing dictionary from stylesheet


   Here's snippet of the XML file which should have matched:
    B B B B B B B B B B B  <Setting Name="TheOneIWant" Type="htf:map">
B B B B B B B B B B B B B  <Setting Name="requiresignedassertion"
Type="xsd:boolean">false</Setting>
B B B B B B B B B B B B B  <Setting Name="succinctid"
Type="xsd:string">2KYi3gZ7THiZU0Hbft/mYgio0PE=</Setting>

    .   .   B B B B B B B B B  </Setting>   .   .
   Also, I think that I may not have been clear about what I want as the
output of running the XSLT...
   If the XSLT was successful, I want the output to be the ENTIRE matching
node, including all the contents of the node, i.e.:
      B B B B B B B B B B B  <Setting Name="TheOneIWant" Type="htf:map">
B B B B B B B B B B B B B  <Setting Name="requiresignedassertion"
Type="xsd:boolean">false</Setting>
B B B B B B B B B B B B B  <Setting Name="succinctid"
Type="xsd:string">2KYi3gZ7THiZU0Hbft/mYgio0PE=</Setting>

    .   .   B B B B B B B B B  </Setting>
   That's why, in my original post, I thought I had to include use of the
identity transformation.

   My apologies if I wasn't clear about that.
   Thanks,   Jim





      On Saturday, March 23, 2024 at 02:09:01 PM EDT, BR Chrisman
brchrisman@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

      Might needB to use <xsl:output method="text"/> as well.
    On Fri, Mar 22, 2024 at 7:19b/PM Liam R. E. Quin liam@xxxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

 On Sat, 2024-03-23 at 01:55 +0000, ohaya ohaya@xxxxxxxxx wrote:
 [...]

 I think what you want is simply XPath here.

 But with XSLT you could use,

 <xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

 B  <xsl:template match="/">
 B  B  <xsl:value-of select="//Setting[@Name = 'TheOneIWant']" />
 B  </xsl:template>
 </xsl:stylesheet>

 The xsl:value-of "instruction" evalueates its argument and converts the
 result to a string (actually a "text node").

 The contents of the "select" attribute is an XPath expression.

 liam


 --
 Liam Quin,B https://www.delightfulcomputing.com/
 Available for XML/Document/Information Architecture/XSLT/
 XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
 Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org



       XSL-List info and archive  EasyUnsubscribe (by email)
XSL-List info and archive  EasyUnsubscribe (by email)

Current Thread