Subject: [xsl] Applied attribute error From: "JS rawat" <jrawat@xxxxxxxxxxxxxx> Date: Sat, 22 Jan 2011 11:33:41 +0530 |
Hi Team, Can anyone help me to find out the error(s) I am doing in the below XSL. I want to do it by variable methodology by which i am getting <xref ref=""/>. Thanks ...JSR Input <doc> <bdy> <sc1><ti>Background</ti> <sc2><ti>Incidence</ti> <p> <lst-ul level="1" format="bull"> <li><p t="fl">50 to 2000 cases per <link class="figcit" rid="FileName_fig1">Image 1</link>.</p></li> <li><p t="fl">Biphasic reactions occur <link class="tbcit" rid="FileName_table1">Table 1</link>.</p></li> </lst-ul> </p></sc2></sc1></bdy> <fig id="FileName_graph1"/> <fig id="FileName_fig1"/> <table id="FileName_table1"/> </doc> XSL <xsl:variable name="incidence"> <xsl:for-each select="//sc2"> <xsl:if test="ti/. eq 'Incidence'"> <xsl:copy-of select="."/> </xsl:if> </xsl:for-each> </xsl:variable> <xsl:key name="ids" match="table|fig" use="@id"/> <xsl:template match="@rid|fig/@id|table/@id"> <xsl:for-each select="key('ids',.)"> <xsl:if test="name(.)='fig'"> <xsl:text/>fig<xsl:number format="001" count="fig" level="any" from="doc"/> </xsl:if> <xsl:if test="name(.)='table'"> <xsl:text/>table<xsl:number format="001" count="table" level="any" from="doc"/> </xsl:if> </xsl:for-each> </xsl:template> <xsl:template match="doc"> <topic> <xsl:apply-templates select="bdy"/> </topic> </xsl:template> <xsl:template match="bdy"> <topic_text> <xsl:apply-templates/> </topic_text> <xsl:apply-templates select="//fig"/> <xsl:apply-templates select="//table"/> </xsl:template> <xsl:template match="sc1"> <xsl:variable name="titletext" select="normalize-space(ti)"/> <xsl:choose> <xsl:when test="$titletext eq 'Background'"> <background> <incidence> <xsl:apply-templates select="$incidence"/> </incidence> </background> </xsl:when> </xsl:choose> </xsl:template> <!-- <xsl:template match="sc1"> <xsl:variable name="titletext" select="normalize-space(ti)"/> <xsl:choose> <xsl:when test="$titletext eq 'Background'"> <background> <xsl:apply-templates/> </background> </xsl:when> </xsl:choose> </xsl:template> <xsl:template match="sc2"> <xsl:variable name="titletext" select="normalize-space(ti)"/> <xsl:choose> <xsl:when test="$titletext eq 'Incidence'"> <incidence> <xsl:apply-templates/> </incidence> </xsl:when> </xsl:choose> </xsl:template> --> <xsl:template match="sc1/ti|sc2/ti"> </xsl:template> <xsl:template match="fig"> <figure> <xsl:attribute name="id"><xsl:apply-templates select="@id"/></xsl:attribute> </figure> </xsl:template> <xsl:template match="table"> <feature> <xsl:attribute name="id"><xsl:apply-templates select="@id"/></xsl:attribute> <xsl:apply-templates/> </feature> </xsl:template> <xsl:template match="lst-ul"> <list style="bulleted"> <xsl:apply-templates/> </list> </xsl:template> <xsl:template match="li"> <listitem> <xsl:apply-templates/> </listitem> </xsl:template> <xsl:template match="link"> <xsl:choose> <xsl:when test="@class='figcit'"> <xref> <xsl:attribute name="ref"><xsl:apply-templates select="@rid"/></xsl:attribute> </xref> </xsl:when> <xsl:when test="@class='grpcit'"> <xref> <xsl:attribute name="ref"><xsl:apply-templates select="@rid"/></xsl:attribute> </xref> </xsl:when> <xsl:when test="@class='tbcit'"> <xref> <xsl:attribute name="ref"><xsl:apply-templates select="@rid"/></xsl:attribute> </xref> </xsl:when> </xsl:choose> </xsl:template> REQUIRED OUTPUT <topic> <topic_text> <background> <incidence> <list style="bulleted"> <listitem>50 to 2000 cases per <xref ref="fig002"/>.</listitem> <listitem>Biphasic reactions occur <xref ref="table001"/>.</listitem> </list> </incidence> </background> </topic_text> <figure id="fig001"/> <figure id="fig002"/> <feature id="table001"/> </topic>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] grouping problem...kinda?, Florent Georges | Thread | Re: [xsl] Applied attribute error, Imsieke, Gerrit, le- |
Re: [xsl] grouping problem...kinda?, David Carlisle | Date | Re: [xsl] Applied attribute error, Imsieke, Gerrit, le- |
Month |