I am wondering what the best way to filtering out a certain repeating element by referencing its attribute tag. I want to suppress the
B1 attribute from being processed.
XML <NameInfo id="B1" AffiliationRefs="I1394"
<NameInfo id="C1" AffiliationRefs="I1263">
<NameInfo id="C2" AffiliationRefs="I1263">
<NameInfo id="C3" AffiliationRefs="I1263">
Current XSLT without additional filter logic <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:bpws="http://---------------/" xmlns:acord="http://------------/xml/"
exclude-result-prefixes="xs"
version="2.0">
<!-- <xsl:variable name="NameInfoId" select="bpws:getVariableData('nameInfoId')"/>-->
<xsl:variable name="NameInfoId">
<!--<InsuredOrPrincipal>
<GeneralPartyInfo>-->
<NameInfo id="C1" xmlns="http://------------/xml/" xmlns:p0="http://-------------/xml/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<!-- </GeneralPartyInfo>
</InsuredOrPrincipal>-->
</xsl:variable>
<xsl:template match="acord:InsuredOrPrincipal">
<!-- <xsl:element name="ID">
<xsl:value-of select="$NameInfoId/NameInfo/@id"/>
</xsl:element>-->
<xsl:variable name="NameInfoId">
<xsl:value-of select="$NameInfoId/acord:NameInfo/@id"/>
</xsl:variable>
<xsl:element name="EmployerContactInfo">
<xsl:for-each select="//acord:NameInfo">
<xsl:if test="./@id = $NameInfoId">
<xsl:element name="PersonName">
<xsl:element name="SurName">
<xsl:value-of select=".//acord:Surname"/>
</xsl:element>
<xsl:element name="GivenName">
<xsl:value-of select=".//acord:GivenName"/>
</xsl:element>
<xsl:element name="OtherGivenName">
<xsl:value-of select=".//acord:OtherGivenName"/>
</xsl:element>
<xsl:element name="TitlePrefix">
<xsl:value-of select=".//acord:TitlePrefix"/>
</xsl:element>
<xsl:element name="NameSuffix">
<xsl:value-of select=".//acord:NameSuffix"/>
</xsl:element>
<xsl:element name="TitleRelationshipDesc">
<xsl:value-of select=".//acord:TitleRelationshipDesc"/>
</xsl:element>
<xsl:for-each select="//acord:PhoneInfo">
<xsl:if test="@id = $NameInfoId">
<xsl:element name="PhoneInfo">
<xsl:element name="PhoneTypeCd">
<xsl:value-of select=".//acord:PhoneTypeCd"></xsl:value-of>
</xsl:element>
<xsl:element name="PhoneNumber">
<xsl:value-of select=".//acord:PhoneNumber"></xsl:value-of>
</xsl:element>
<xsl:element name="EmailAddr">
<xsl:value-of select=".//acord:EmailAddr"></xsl:value-of>
</xsl:element>
</xsl:element>
</xsl:if>
</xsl:for-each>
</xsl:element>
</xsl:if>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>
[edited by: httpwebwitch at 9:51 pm (utc) on Mar 3, 2010]
[edit reason] removed URLs from namespaces [/edit]