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

Re: New XSLT NOT WORKING was Re: XSLT to populate a SA

Subject: Re: New XSLT NOT WORKING was Re: XSLT to populate a SAML AttributeStatement from an XML
From: "Eliot Kimber eliot.kimber@xxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 22 Jan 2023 13:54:29 -0000
Re: New XSLT NOT WORKING was Re:  XSLT to populate a SA
I would write not(*) as empty(*) but it means the same thing:

<xsl:template match=*[empty(*)]>

Cheers,

E.

_____________________________________________
Eliot Kimber
Sr Staff Content Engineer
O: 512 554 9368
M: 512 554 9368
servicenow.com<https://www.servicenow.com>
LinkedIn<https://www.linkedin.com/company/servicenow> |
Twitter<https://twitter.com/servicenow> |
YouTube<https://www.youtube.com/user/servicenowinc> |
Facebook<https://www.facebook.com/servicenow>

From: BR Chrisman brchrisman@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sunday, January 22, 2023 at 1:43 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: New XSLT NOT WORKING was Re:  XSLT to populate a SAML
AttributeStatement from an XML
[External Email]

________________________________
It will match an element that has no child elements.

On Sat, Jan 21, 2023 at 11:19 PM ohaya ohaya@xxxxxxxxx<mailto:ohaya@xxxxxxxxx>
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx
rytech.com>> wrote:
Hi,

I was wondering if someone could explain what:

<xsl:template match="*[not(*)]">

does?

Is that not(*) checking for non-empty nodes?

Thanks,
Jim

On Saturday, January 21, 2023, 05:00:18 AM EST, Martin Honnen
martin.honnen@xxxxxx<mailto:martin.honnen@xxxxxx>
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx
rytech.com>> wrote:



Am 1/21/2023 um 10:02 AM schrieb ohaya
ohaya@xxxxxxxxx<mailto:ohaya@xxxxxxxxx>:
> Hi,
>
> I was wondering, is it possible to add a condition to this:
>
> <xsl:template match="/record/adrRecord/*">
>
> for only if the node has no value?
>
> If it is possible, how to do that, and also do you all think this
> would fix the problem that is happening?


I am wondering if the input sample


<record>
<adrRecord>
<PN_ID>1111111</PN_ID>
<personnel>
<ADM_ORG_CD>urn:NORM:DEPT</ADM_ORG_CD>
<DOD_ASSOC_CD>urn:NORM:V01</DOD_ASSOC_CD>
</personnel>
<enterpriseUser>
<entUserRoles>a:b:c</entUserRoles>
</enterpriseUser>
</adrRecord>
</record>


transformed by e.g.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform<http://www.w3.org/1999/XSL/Tr
ansform>"
  version="2.0"
  xmlns:xs="http://www.w3.org/2001/XMLSchema<http://www.w3.org/2001/XMLSchema
>"
  xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance<http://www.w3.org/2001
/XMLSchema-instance>"
  exclude-result-prefixes="xs">

  <xsl:output indent="yes"/>

  <xsl:template match="*">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="text()"/>

  <xsl:template match="/">
    <saml:AttributeStatement>
      <xsl:apply-templates/>
    </saml:AttributeStatement>
  </xsl:template>

  <xsl:template match="*[not(*)]">
    <saml:Attribute Name="{name()}"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
      <xsl:for-each select="tokenize(.,':')">
        <saml:AttributeValue
xmlns:xsd="http://www.w3.org/2001/XMLSchema<http://www.w3.org/2001/XMLSchema>"
xsi:type="xsd:string">
          <xsl:value-of select="."/>
        </saml:AttributeValue>
      </xsl:for-each>
    </saml:Attribute>
  </xsl:template>

</xsl:stylesheet>


into e.g.

<saml:AttributeStatement
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance<http://www.w3.org/2001/X
MLSchema-instance>">
   <saml:Attribute Name="PN_ID"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
      <saml:AttributeValue
xsi:type="xsd:string">1111111</saml:AttributeValue>
   </saml:Attribute>
   <saml:Attribute Name="ADM_ORG_CD"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
      <saml:AttributeValue xsi:type="xsd:string">urn</saml:AttributeValue>
      <saml:AttributeValue xsi:type="xsd:string">NORM</saml:AttributeValue>
      <saml:AttributeValue xsi:type="xsd:string">DEPT</saml:AttributeValue>
   </saml:Attribute>
   <saml:Attribute Name="DOD_ASSOC_CD"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
      <saml:AttributeValue xsi:type="xsd:string">urn</saml:AttributeValue>
      <saml:AttributeValue xsi:type="xsd:string">NORM</saml:AttributeValue>
      <saml:AttributeValue xsi:type="xsd:string">V01</saml:AttributeValue>
   </saml:Attribute>
   <saml:Attribute Name="entUserRoles"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
      <saml:AttributeValue xsi:type="xsd:string">a</saml:AttributeValue>
      <saml:AttributeValue xsi:type="xsd:string">b</saml:AttributeValue>
      <saml:AttributeValue xsi:type="xsd:string">c</saml:AttributeValue>
   </saml:Attribute>
</saml:AttributeStatement>

is perhaps all you want to output?


But with so many posts I have lost track of what the input is and what
the wanted output is.

XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/965995> (by
email)
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/3453418> (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.