I'm trying to build an XSLT file to:
check if a node exists, and if it doesn't to fill it in with a "0"
if the node does exists, check to make sure each attribute is present, and if there's a missing attribute fill it in with a "0"
I figured I can do this with a <xsl:if/> but I'd like to avoid this because there's around 56 attributes I'd have to check for.
Here's what the main XML looks like:
<player name="KLINE, Zach" shortname="KLINE, Zach" checkname="KLINE,ZACH" uni="1Q" class="SR" gp="1" code="1Q"> <rush att="1" yds="11" gain="11" loss="0" td="0" long="11"></rush> <pass comp="7" att="11" int="1" yds="110" td="0" long="32" sacks="0" sackyds="0"></pass> </player> <player name="JORDAN, Jamire" shortname="JORDAN, Jamire" checkname="JORDAN,JAMIRE" uni="1" class="SO" gp="1" code="1"> <rush att="1" yds="1" gain="1" loss="0" td="0" long="1"></rush> <rcv no="5" yds="52" td="0" long="16"></rcv> </player> The output should look like this:
<player name="KLINE, Zach" shortname="KLINE, Zach" checkname="KLINE,ZACH" uni="1Q" class="SR" gp="1" code="1Q"> <rush att="1" yds="11" gain="11" loss="0" td="0" long="11"></rush> <pass comp="7" att="11" int="1" yds="110" td="0" long="32" sacks="0" sackyds="0"></pass> <rcv no="0" yds="0" td="0" long="0"></rcv> </player> <player name="JORDAN, Jamire" shortname="JORDAN, Jamire" checkname="JORDAN,JAMIRE" uni="1" class="SO" gp="1" code="1"> <rush att="1" yds="1" gain="1" loss="0" td="0" long="1"></rush> <pass comp="0" att="0" int="0" yds="0" td="0" long="0" sacks="0" sackyds="0"></pass> <rcv no="5" yds="52" td="0" long="16"></rcv> </player>