[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Aw: Re: Trying to Extract a node with matching attrib

Subject: Aw: Re: Trying to Extract a node with matching attribute value with xsltproc
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 24 Mar 2024 08:35:41 -0000
Aw: Re:  Trying to Extract a node with  matching attrib
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
  :(....  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:
  <Setting Name="TheOneIWant" Type="htf:map">
             &n bsp;  <Setting Name="requiresignedassertion"
  Type="xsd:boolean">false</Setting>
             &n bsp;  <Setting Name="succinctid"
  Type="xsd:string">2KYi3gZ7THiZU0Hbft/mYgio0PE=</Setting>

  . . </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.:
  <Setting Name="TheOneIWant" Type="htf:map">
  <Setting Name="requiresignedassertion"
  Type="xsd:boolean">false</Setting>
  <Setting Name="succinctid"
  Type="xsd:string">2KYi3gZ7THiZU0Hbft/mYgio0PE=</Setting>

  . . </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 need 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@lists. mulberrytech.com>
  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/Transf orm">

    <xsl:template match="/">
    <xsl:value-of select="//Setting[@Name = 'TheOneIWant']" />
    </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, https://www.delightfulcomputing.c om/
    Available for XML/Document/Information Architecture/XSLT/
    XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
    Barefoot Web-slave, antique illustrations:
    http://www.fromoldbooks.org

  XSL-List info and archiveEasyUnsubscribe (by email) XSL-List info and
  archiveEasyUnsubscribe (by email)

XSL-List info and archiveEasyUnsubscribe (by email)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.