Hi,
I have an xml file and want to print author name twice, first in <AUG> tag and second in <AUGAFF> tag. But in <AUGAFF> tag author name should be print as per the <AFF OID="af1"> and <AU ORF="af1 af3">
For example if <AU ORF="af1 af3"> is coming like this that means it should be print in <AFF OID="af1"> and <AFF OID="af2">. Please see the exmple In.xml and Out.xml for reference. I also pasted my XSLT for the same.
Could anybody help me on this.
Thanks,
Anil Yadav
Note: The text 'By' is placed according to $jid.
In.xml
Code:
<ROOT>
<AUG>
<AU ORF="af1 af3" CORF="corr1">
<NMSFX>Dr.</NMSFX>
<FNMS>Hanghui</FNMS>
<SNM>Chen</SNM>
</AU>
<AU ORF="af2">
<NMSFX>Dr.</NMSFX>
<FNMS>Alexie M.</FNMS>
<SNM>Kolpak</SNM>
</AU>
<AU ORF="af1 af2 af3">
<NMSFX>Prof.</NMSFX>
<FNMS>Sohrab</FNMS>
<SNM>Ismail-Beigi</SNM>
</AU>
<AFF TYPE="ORG" CNY="US" OID="af1">Department of Physics, Yale University, New Haven, CT 06570 (USA)</AFF>
<AFF TYPE="ORG" CNY="US" OID="af2">Department of Applied Physics, Yale University New Haven, CT 06570-8284 (USA)</AFF>
<AFF TYPE="ORG" CNY="US" OID="af3">Center for Research on Interface Structures and Phenomena (CRISP), Yale University, New Haven, CT 06570-8284 (USA)</AFF>
<CORR ID="corr1">Department of Physics, Yale University, New Haven, CT 06570 (USA)</CORR>
</AUG>
</ROOT>
Out.xml
Code:
<ROOT>
<AUG><TBDEL>By </TBDEL><AU ORF="af1 af3" CORF="corr1"><FNMS>Hanghui</FNMS> <SNM>Chen</SNM><TBDEL>, </TBDEL></AU><AU ORF="af2"><FNMS>Alexie M.</FNMS> <SNM>Kolpak</SNM><TBDEL>, </TBDEL></AU><AU ORF="af1 af2 af3"><FNMS>Sohrab</FNMS> <SNM>Ismail-Beigi</SNM></AU></AUG>
<AUGAFF>
<AFF TYPE="ORG" CNY="US" OID="af1"><AU ORF="af1 af3" CORF="corr1"><NMSFX>Dr.</NMSFX><FNMS>Hanghui</FNMS><SNM>Chen</SNM></AU> <AU ORF="af1 af2 af3"><NMSFX>Prof.</NMSFX><FNMS>Sohrab</FNMS><SNM>Ismail-Beigi</SNM></AU> Department of Physics, Yale University, New Haven, CT 06570 (USA)</AFF>
<AFF TYPE="ORG" CNY="US" OID="af2"><AU ORF="af2"><NMSFX>Dr.</NMSFX><FNMS>Alexie M.</FNMS><SNM>Kolpak</SNM></AU> <AU ORF="af1 af2 af3"><NMSFX>Prof.</NMSFX><FNMS>Sohrab</FNMS><SNM>Ismail-Beigi</SNM></AU> Department of Applied Physics, Yale University New Haven, CT 06570-8284 (USA)</AFF>
<AFF TYPE="ORG" CNY="US" OID="af3"><AU ORF="af1 af3" CORF="corr1"><NMSFX>Dr.</NMSFX><FNMS>Hanghui</FNMS><SNM>Chen</SNM></AU> <AU ORF="af1 af2 af3"><NMSFX>Prof.</NMSFX><FNMS>Sohrab</FNMS><SNM>Ismail-Beigi</SNM></AU> Center for Research on Interface Structures and Phenomena (CRISP), Yale University, New Haven, CT 06570-8284 (USA)</AFF>
<CORR ID="corr1">Department of Physics, Yale University, New Haven, CT 06570 (USA)</CORR>
</AUGAFF>
</ROOT>
XSLT
Code:
<xsl:template match="AUG">
<AUG>
<xsl:if test="$jid='adma'">
<xsl:attribute name="aid:pstyle">AU</xsl:attribute>
<TBDEL><xsl:text>By </xsl:text></TBDEL>
<xsl:apply-templates select="AU" mode="AuthorWithoutAffiliation"/>
</xsl:if>
<xsl:if test="$jid='SMALL'">
<xsl:attribute name="aid:pstyle">AU</xsl:attribute>
<xsl:apply-templates select="AU" mode="AuthorWithoutAffiliation"/>
</xsl:if>
</AUG>
<AUGAFF>
<xsl:apply-templates/>
</AUGAFF>
</xsl:template>
<xsl:template match="AU" mode="AuthorWithoutAffiliation">
<AU>
<xsl:copy-of select="@*"/>
<xsl:if test="position()=last()">
<!-- <xsl:text>and </xsl:text>-->
<xsl:apply-templates select="SNM|FNMS|EAD"/>
</xsl:if>
<xsl:if test="not(position()=last())">
<xsl:apply-templates select="SNM|FNMS|EAD"/>
<TBDEL><xsl:text>, </xsl:text></TBDEL>
</xsl:if>
</AU>
</xsl:template>
<xsl:template match="AU">
<AU>
<xsl:copy-of select="@*"/>
<xsl:if test="position()=last()">
<!-- <xsl:text>and </xsl:text>-->
<xsl:apply-templates select="NMSFX|SNM|FNMS|EAD"/>
</xsl:if>
<xsl:if test="not(position()=last())">
<xsl:apply-templates select="NMSFX|SNM|FNMS|EAD"/>
<TBDEL><xsl:text>, </xsl:text></TBDEL>
</xsl:if>
</AU>
</xsl:template>
<xsl:template match="AU/NMSFX">
<NMSFX>
<xsl:apply-templates/>
</NMSFX>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="AU/FNMS">
<FNMS>
<xsl:apply-templates/>
</FNMS>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="EAD">
<xsl:element name="EAD">
<xsl:attribute name="ead"><xsl:value-of select="."/></xsl:attribute>
<xsl:copy-of select="@*"/>
<TBDEL><xsl:text>*</xsl:text></TBDEL>
</xsl:element>
</xsl:template>