Subject: [xsl] Tag movement in XML From: "Ganesh Babu N" <nbabuganesh@xxxxxxxxx> Date: Mon, 15 Sep 2008 16:42:58 +0530 |
Dear All, I am having XML fragment in the following way... <D AN="0019053-200826080-00001" V="2000.3F" FILE="G0019053-200826080-00001"> <BB> <TG> <TI>Waiting for Reimbursement of New Medicines in Canada</TI> <STI>It<!-- ’ -->s Time for a Rethink</STI> </TG> <BY> <PN> <FN>Brett</FN> <MN>J</MN> <SN>Skinner</SN> </PN> <AF> <P>Department of Health and Pharmaceutical Policy Research; Department of Insurance Policy Research, Fraser Institute, Toronto, Ontario, Canada</P> </AF> <BT> <P>Correspondence<!-- : --> <E T="I">Brett J. Skinner</E>, Department of Health and Pharmaceutical Policy Research; Department of Insurance Policy Research, Fraser Institute, 401-1491 Yonge Street, Toronto, ON M4T 1Z4, Canada. E-mail<!-- : --> <URL>brett.skinner<!-- @ -->fraserinstitute.org</URL> </P> </BT> </BY> <SO> <PB>PharmacoEconomics</PB> <ISN>1170-7690</ISN> <DA> <YR>2008</YR> </DA><V>26</V> <IS> <IP>8</IP> </IS> <PG>629-632</PG> </SO> <DT>Commentary</DT> </BB> <AB> <HD>Abstract</HD> <ABS> <P>Available evidence indicates that patients who have private sector drug insurance are immediately covered for all new medically necessary drugs certified by Health Canada, with few exceptions. The experience for patients who are dependent on public drug programmes is much worse. Evidence indicates that, on average across the provinces, far less than half of the drugs certified by Health Canada are finally approved by the provinces for public reimbursement. Publicly insured patients also wait up to 1<!-- -->year longer than privately insured patients to get insurance coverage for new drugs. Evidence also shows that public drug coverage varies widely across provinces.</P> </ABS> </AB> The resultant output required is .... Template-Type: ReDIF-Article 1.0 Author-Name: Brett J. Skinner Author-Name-First: Brett Author-Name-Last: Skinner Author-Workplace-Name: Department of Health and Pharmaceutical Policy Research; Department of Insurance Policy Research, Fraser Institute, Toronto, Ontario, Canada Title: Waiting for Reimbursement of New Medicines in Canada: Its Time for a Rethink Abstract: Available evidence indicates that patients who have private sector drug insurance are immediately covered for all new medically necessary drugs certified by Health Canada, with few exceptions. The experience for patients who are dependent on public drug programmes is much worse. Evidence indicates that, on average across the provinces, far less than half of the drugs certified by Health Canada are finally approved by the provinces for public reimbursement. Publicly insured patients also wait up to 1year longer than privately insured patients to get insurance coverage for new drugs. Evidence also shows that public drug coverage varies widely across provinces. Journal: PharmacoEconomics Pages: 629-632 Volume: 26 Issue: 8 Year: 2008 My style sheet is as follows: <xsl:template match="MN | BT | BD | ED"> </xsl:template> <xsl:template match="D"> <xsl:for-each select="."> <xsl:variable name="filename" select="concat(@AN,'.rdf')"/> <xsl:value-of select="$filename" /> <!-- Creating --> <xsl:result-document href="{$filename}" format="text"> Template-Type: ReDIF-Article 1.0 <xsl:apply-templates/> </xsl:result-document> </xsl:for-each> </xsl:template> <xsl:template match="PN"> Author-Name: <xsl:value-of select="FN"/><xsl:text> </xsl:text><xsl:if test="MN"><xsl:value-of select="MN"/>. </xsl:if><xsl:value-of select="SN"/> <xsl:apply-templates/> </xsl:template> <xsl:template match="FN"> Author-Name-First: <xsl:apply-templates/> </xsl:template> <xsl:template match="SN"> Author-Name-Last: <xsl:apply-templates/> </xsl:template> <xsl:template match="AF/P"> Author-Workplace-Name: <xsl:apply-templates/> </xsl:template> <xsl:template match="TG"> Title: <xsl:copy-of select="TI"/>: <xsl:copy-of select="STI"/> </xsl:template> <xsl:template match="AB"> <xsl:value-of select="HD"/>: <xsl:value-of select="ABS/P"/> </xsl:template> <xsl:template match="SO"> Journal: <xsl:value-of select="PB"/> Pages: <xsl:value-of select="PG"/> Volume: <xsl:value-of select="V"/> Issue: <xsl:value-of select="IS/IP"/> Year: <xsl:value-of select="DA/YR"/> </xsl:template> </xsl:stylesheet> With this style sheet I am able to get the desired output with two exceptions. Title and abstract are appearing as per the XML order and not appearing as per the required output. Please let me know how to move these two tags into desired locations. Regards, Ganesh
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Removing duplicates based, George Cristian Bina | Thread | Re: [xsl] Tag movement in XML, David Carlisle |
RE: [xsl] Process document by ignor, Syd Bauman | Date | Re: [xsl] Tag movement in XML, David Carlisle |
Month |