[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Getting values from different templates
Here i have pasted partial of the code. I am replacing {sub} to <sub> and
{/sub} to </sub>
Code to retrieve contents before this symbol '|' ------------------------------------------------------------- <xsl:template match="content"> <xsl:variable name="string11"> <xsl:value-of select="substring-before(.,'|')"/> </xsl:variable> <xsl:if test="(contains($string11,'{sub}'))"> <xsl:call-template name="replacebeforesub"> <xsl:with-param name="string1" select="$string11"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template name="replacebeforesub"> <xsl:param name="string1"/> <xsl:variable name="string11"> <xsl:if test="(contains($string1,'{sub}'))"> <xsl:value-of select="substring-before($string1,'{sub}')"/> <sub> <xsl:value-of select="substring-before(substring-after($string1,'{sub}'),'{/sub}')"/> </sub> <xsl:value-of select="substring-after($string1,'{/sub}' )" /> </xsl:if> </xsl:variable> <xsl:if test="(contains($string1,'{sub}'))"> <xsl:call-template name="replacebeforesub"> <xsl:with-param name="string1" select="$string11"/> </xsl:call-template> </xsl:if> <xsl:if test=3D"not((contains($string1,'{sub}')))"> <xsl:call-template name="replacebeforesubclose"> <xsl:with-param name="stringfinal1" select="$string1"/> </xsl:call-template> </xsl:if> </xsl:template> <xsl:template name="replacebeforesubclose"> <xsl:param name="stringfinal1"/> <xsl:call-template name="finalfirst"> <xsl:with-param name="stringfirst" select="$stringfinal1"/> </xsl:call-template> </xsl:template> Here is the code to retrieve contents in btw these symbols '|' '\' ------------------------------------------------------------------- <xsl:template match="content"> <xsl:variable name="string1"> <xsl:value-of select="substring-before(substring-after(.,'|'),'\')"/> </xsl:variable> <xsl:if test="(contains($string1,'{sub}'))"> <xsl:call-template name="replacemidsub"> <xsl:with-param name="string" select="$string1"/> </xsl:call-template> </xsl:if> </xsl:template>
<xsl:template name=3D"replacemidsubclose"> <xsl:param name=3D"stringfinal"/> <xsl:call-template name="finalmidstring"> <xsl:with-param name="stringmid" select="$stringfinal"/> </xsl:call-template> </xsl:template> --------------------------------------------------------- code to retrieve contents after this symbol '\' ------------------------------------------------------- <xsl:template match="content"> <xsl:variable name="string1"> <xsl:value-of select="substring-before(substring-after(.,'|'),'\')"/> </xsl:variable> <xsl:if test="(contains($string1,'{sub}'))"> <xsl:call-template name="replacemidsub"> <xsl:with-param name="string" select="$string1"/> </xsl:call-template> </xsl:if> </xsl:template>
<xsl:template name="replacemidsubclose"> <xsl:param name="stringfinal"/> <xsl:call-template name="finalendstring"> <xsl:with-param name="stringend" select="$stringfinal"/> </xsl:call-template> </xsl:template> -------------------------------------------------------------- my input file looks like this. <content>statement1 |option1\ statement2 </content> <content>statement1 }option1\ statement2 </content>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|