homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

XSLT and Nested Evaluation Statements

Msg#: 4090117 posted 5:31 pm on Mar 2, 2010 (gmt 0)

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.

<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/"

<!-- <xsl:variable name="NameInfoId" select="bpws:getVariableData('nameInfoId')"/>-->
<xsl:variable name="NameInfoId">
<NameInfo id="C1" xmlns="http://------------/xml/" xmlns:p0="http://-------------/xml/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
<!-- </GeneralPartyInfo>

<xsl:template match="acord:InsuredOrPrincipal">

<!-- <xsl:element name="ID">
<xsl:value-of select="$NameInfoId/NameInfo/@id"/>

<xsl:variable name="NameInfoId">
<xsl:value-of select="$NameInfoId/acord:NameInfo/@id"/>

<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 name="GivenName">
<xsl:value-of select=".//acord:GivenName"/>
<xsl:element name="OtherGivenName">
<xsl:value-of select=".//acord:OtherGivenName"/>
<xsl:element name="TitlePrefix">
<xsl:value-of select=".//acord:TitlePrefix"/>
<xsl:element name="NameSuffix">
<xsl:value-of select=".//acord:NameSuffix"/>
<xsl:element name="TitleRelationshipDesc">
<xsl:value-of select=".//acord:TitleRelationshipDesc"/>

<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 name="PhoneNumber">
<xsl:value-of select=".//acord:PhoneNumber"></xsl:value-of>
<xsl:element name="EmailAddr">
<xsl:value-of select=".//acord:EmailAddr"></xsl:value-of>


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


[edited by: httpwebwitch at 9:51 pm (utc) on Mar 3, 2010]
[edit reason] removed URLs from namespaces [/edit]



WebmasterWorld Administrator httpwebwitch us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4090117 posted 10:00 pm on Mar 10, 2010 (gmt 0)

Hi jmorgan1422,
welcome to WebmasterWorld!

my guess is you'll use an if or a choose, using an XPATH condition that matches nodes without that attribute... any luck on this yet?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved