Re: ALMOST WORKING was Re: [xsl] XSLT to populate a SAML AttributeStatement from an XML

Subject: Re: ALMOST WORKING was Re: [xsl] XSLT to populate a SAML AttributeStatement from an XML
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 19 Jan 2023 15:28:12 -0000
Am 1/19/2023 um 2:05 PM schrieb ohaya ohaya@xxxxxxxxx:
I tried the XSLT on the gateway, which does have XSLT 2.0. It looks
like it worked, but it's generating some "EXTRANEOUS" output...
specifically,
it looks like is outputting the VALUE of some the other elements, I am
not sure why :(...


There are built-in templates that copy text nodes through, thus where you use apply-templates but have elements selected not matched by your templates the built-in templates copy the text nodes through.


Usually <xsl:template match="text()"/> helps against that.



Also in all those case you match explicitly against a certain element that element becomes the context node for the template's code so you usually want e.g.

B  <xsl:template match="/record/adrRecord/personnel/ADM_ORG_CD">
<saml:Attribute Name="MY_ORG_CD"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xsi:type="xsd:string"> <xsl:value-of select="." />
</saml:AttributeValue>
</saml:Attribute>
</xsl:template>


and not


<xsl:template match="/record/adrRecord/personnel/ADM_ORG_CD">
<saml:Attribute Name="MY_ORG_CD"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xsi:type="xsd:string"> <xsl:value-of
select="/record/adrRecord/personnel/ADM_ORG_CD" />
</saml:AttributeValue>
</saml:Attribute>
</xsl:template>

Current Thread