Raja1205 Posted June 26, 2012 Report Share Posted June 26, 2012 (edited) Hello Friends, I am new (i.e learning) to XSL and this forum. I need some help from the XSL experts. My problem is: For the following snippet <italic> style (i.e <i>) not working when <italic> present within <title> or <subtitle> tags. But <italic> works when present in <p> tag. Kindly adivise what is the actual problem and how to solve this problem.Attached sample.xml, sample.xsl Example: 1 <title-group><label>Chapter Two</label><title>THE <italic>1920s</italic> TO THE 1950s:</title><subtitle>THE LONG ROAD TOWARD <italic>U.S. LEADERSHIP</italic> IN FIGHTER R&D</subtitle></title-group> Note: I am unable to upload .xsl file. So i am the complete XSL coding below: XSL:-----<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title>Sample-BOOK</title> </head> <body bgcolor="#EEF8FD"> <TABLE WIDTH="100%"> <TR> <TD width="5%"></TD><TD> <xsl:for-each select="book"> <p style="text-align:center;background: transparent;margin-top: .05em;font-weight: 800;font-size: 26pt;font-family: Georgia;color: #003399"><xsl:for-each select="body/book-part"> <xsl:value-of select="@book-part-type"/></xsl:for-each></p> <table border="1.5" bordercolor="#0080C0" align="center" width="100%" cellpadding="2" cellspacing="2" style="border-collapse:collapse;"> <tr bgcolor="#0080C0" align="center"> <td><span style="font-family: Verdana;color: white;font-weight: bold;font-size: 11">BOOK ID</span></td> <td><span style="font-family: Verdana;color: white;font-weight: bold;font-size: 11">LANG</span></td> <td><span style="font-family: Verdana;color: white;font-weight: bold;font-size: 11">VERSION-ID</span></td> <td><span style="font-family: Verdana;color: white;font-weight: bold;font-size: 11">SUBMISSION-ID</span></td> </tr> <tr align="center"> <td><span style="font-family: Verdana;font-size: 12"><xsl:for-each select="book-meta"><xsl:value-of select="book-id[@pub-id-type=doi]"/></xsl:for-each></span></td> <td><span style="font-family: Verdana;font-size: 12"><xsl:for-each select="."><xsl:value-of select="@xml:lang"/></xsl:for-each></span></td> <td><span style="font-family: Verdana;font-size: 12"><xsl:for-each select="book-meta"><xsl:value-of select="book-id[@pub-id-type=versionid]"/></xsl:for-each></span></td> <td><span style="font-family: Verdana;font-size: 12"><xsl:for-each select="book-meta"><xsl:value-of select="book-id[@pub-id-type=submissionid]"/></xsl:for-each></span></td> </tr> </table> <br/> <p><xsl:apply-templates/></p> </xsl:for-each> </TD> <TD width="5%"></TD> </TR> </TABLE> </body> </html></xsl:template><xsl:template match="book-meta"> <xsl:apply-templates/></xsl:template><xsl:template match="book-id"></xsl:template><!-- subject --><xsl:template match="book-categories"> <p style="color:#a3a3a3"><u><b>SUBJECT:</b></u><xsl:apply-templates/></p><hr style="border-style:dotted solid; color:#0080C0; height: 1px;" /></xsl:template><xsl:template match="subj-group/subject[@content-type=call-number]"> <p style="text-align: justify;margin-top: 0.5 em;font-size: 12pt;font-family: Helvetica; color:#000099"> <xsl:apply-templates/></p></xsl:template><xsl:template match="subj-group/subject[@content-type=lcsh]"> <p style="text-align: justify;margin-top: 0.5 em;font-size: 12pt;font-family: Helvetica; color:#006666"><xsl:apply-templates/> </p></xsl:template><xsl:template match="subj-group/subj-group/subject"> <p style="text-align: justify;margin-top:-0.8em;font-size: 12pt;font-family: Helvetica; color:#006666"> <xsl:apply-templates/> </p></xsl:template><xsl:template match="subj-group/subj-group/subj-group/subject"> <p style="text-align: justify;margin-top: -0.8 em;display: block;font-size: 12pt;font-family: Helvetica; color:#006666"> <xsl:apply-templates/> </p></xsl:template><xsl:template match="subj-group/subj-group/subj-group/subj-group/subject"> <p style="text-align: justify;margin-top: -0.8 em;display: block;font-size: 12pt;font-family: Helvetica; color:#006666"> <xsl:apply-templates/> </p></xsl:template><xsl:template match="subj-group/subj-group/subj-group/subj-group/subj-group/subject"> <p style="text-align: justify;margin-top: -0.8 em;display: block;font-size: 12pt;font-family: Helvetica; color:#006666"> <xsl:apply-templates/> </p></xsl:template><!-- contrib --><xsl:template match="contrib-group"> <p style="color:#a3a3a3"><u><b>CONTRIBUTOR GROUP:</b></u><xsl:apply-templates/></p><hr style="border-style:dotted solid; color:#0080C0; height: 1px;" /></xsl:template><xsl:template match="role"> <p style="text-align: justify;font-size: 12pt;font-family: Helvetica; color:#000099"> <table border="1.5" bordercolor="#0080C0" align="center" width="100%" cellpadding="2" cellspacing="2" style="border-collapse:collapse;"><tr bgcolor="#d2f0ff" align="center"><td><span style="color:#a3a3a3;font-size: 10pt">Type</span></td><td><span style="color:#a3a3a3;font-size: 10pt">Group Role</span></td></tr> <tr><td><span style="color:#ff00ff;"><xsl:value-of select="@content-type"/></span></td><td><xsl:apply-templates/></td> </tr></table> </p></xsl:template><xsl:template match="contrib"> <p style="text-align: justify;font-size: 12pt;font-family: Helvetica; color:#000099"> <table border="1.5" bordercolor="#0080C0" align="center" width="100%" cellpadding="2" cellspacing="2" style="border-collapse:collapse;"><tr bgcolor="#d2f0ff" align="center"><td><span style="color:#a3a3a3;font-size: 10pt">Type</span></td><td><span style="color:#a3a3a3;font-size: 10pt">Contrib ID</span></td><td><span style="color:#a3a3a3;font-size: 10pt">Collab</span></td> <td><span style="color:#a3a3a3;font-size: 10pt">Srting</span></td><td><span style="color:#a3a3a3;font-size: 10pt">Role</span></td><td><span style="color:#a3a3a3;font-size: 10pt">Surname</span></td><td><span style="color:#a3a3a3;font-size: 10pt">Given-Name</span></td><td><span style="color:#a3a3a3;font-size: 10pt">Prefix</span></td><td><span style="color:#a3a3a3;font-size: 10pt">Suffix</span></td></tr> <tr><td><span style="color:#ff00ff;"><xsl:value-of select="@contrib-type"/></span></td> <td><span style="color:#ff9966;"><xsl:value-of select="@id"/></span></td> <td><span style="color:#666600;"><xsl:value-of select="collab"/></span></td> <td><span style="color:#663300;"><xsl:value-of select="string-name"/></span></td> <td><span style="color:#000099"><xsl:value-of select="role"/></span></td> <td><span style="color:#ff0000;"><xsl:value-of select="name/surname"/></span></td> <td><span style="color:#663300;"><xsl:value-of select="name/given-names"/></span></td> <td><span style="color:#0000ff;"><xsl:value-of select="name/prefix"/></span></td> <td><span style="color:#009900;"><xsl:value-of select="name/suffix"/></span></td> </tr></table> </p></xsl:template><!-- publisher location --><xsl:template match="publisher"> <p style="color:#a3a3a3"><u><b>PUBLISHER LOC:</b></u><xsl:apply-templates/></p><hr style="border-style:dotted solid; color:#0080C0; height: 1px;" /></xsl:template><xsl:template match="publisher-loc"> <p style="text-align: justify;font-size: 12pt;font-family: Helvetica; color:#000000"><xsl:apply-templates/></p></xsl:template><!-- ISSN --><xsl:template match="issn"> <p style="color:#a3a3a3"><u><b>ISSN:</b></u></p> <p style="text-align: justify;margin-top: 0.5 em;font-size: 12pt;font-family: Helvetica;"><xsl:apply-templates/></p> <hr style="border-style:dotted solid; color:#0080C0; height: 1px;" /></xsl:template><!-- copy right --><xsl:template match="permissions"> <p style="color:#a3a3a3"><u><b>COPYRIGHTS:</b></u><xsl:apply-templates/></p><hr style="border-style:dotted solid; color:#0080C0; height: 1px;" /></xsl:template><xsl:template match="copyright-year"> <p style="text-align: justify;font-size: 12pt;font-family: Helvetica;color:#000000"><xsl:apply-templates/></p></xsl:template><xsl:template match="copyright-holder"> <p style="text-align: justify;font-size: 12pt;font-family: Helvetica;color:#000000"><xsl:apply-templates/></p></xsl:template><!-- book pdf --><xsl:template match="alternate-form"><p style="color:#a3a3a3;"><u><b>BOOK PDF:</b></u></p><p style="text-align: justify;font-size: 12pt;font-family: Helvetica;color:#000000"><xsl:value-of select="@xlink:href"/></p><hr style="border-style:dotted solid;color:#0080C0; height: 1px;" /></xsl:template><!-- toc --><xsl:template match="book-part[@book-part-type=book-toc-page-order]"> <p><span style="color:#a3a3a3"><u><b>TOC:</b></u></span><xsl:apply-templates/></p><hr style="border-style:dotted solid; color:#0080C0; height: 1px;" /></xsl:template><xsl:template match="book-part-meta"> <xsl:choose> <xsl:when test="count(ancestor::book-part) = 2"> <p style="font-size: 20; font-family:Helvetica "><span style="color:#333399" ><xsl:value-of select="book-part-id" /></span> <span style="color:#408080" ><xsl:value-of select="title-group/label" /></span> <xsl:value-of select="title-group/title" /> <span style="color:brown;"><xsl:value-of select="title-group/subtitle" /></span></p> </xsl:when> <xsl:when test="count(ancestor::book-part) = 3"> <p style="font-size: 18; font-family:Helvetica; margin-left:20px; "><span style="color:#333399" ><xsl:value-of select="book-part-id" /></span> <span style="color:#408080" ><xsl:value-of select="title-group/label" /></span> <xsl:value-of select="title-group/title" /> <span style="color:brown;"><xsl:value-of select="title-group/subtitle" /></span></p> </xsl:when> <xsl:when test="count(ancestor::book-part) = 4"> <p style="font-size: 16; font-family:Helvetica; margin-left:40px; "><span style="color:#333399" ><xsl:value-of select="book-part-id" /></span> <span style="color:#408080" ><xsl:value-of select="title-group/label" /></span> <xsl:value-of select="title-group/title" /> <span style="color:brown;"><xsl:value-of select="title-group/subtitle" /></span></p> </xsl:when> <xsl:when test="count(ancestor::book-part) = 5"> <p style="font-size: 14; font-family:Helvetica; margin-left:60px; "><span style="color:#333399" ><xsl:value-of select="book-part-id" /></span> <span style="color:#408080" ><xsl:value-of select="title-group/label" /></span> <xsl:value-of select="title-group/title" /> <span style="color:brown;"><xsl:value-of select="title-group/subtitle" /></span></p> </xsl:when> <xsl:when test="count(ancestor::book-part) = 6"> <p style="font-size: 12; font-family:Helvetica; margin-left:80px; "><span style="color:#333399" ><xsl:value-of select="book-part-id" /></span> <span style="color:#408080" ><xsl:value-of select="title-group/label" /></span> <xsl:value-of select="title-group/title" /> <span style="color:brown;"><xsl:value-of select="title-group/subtitle" /></span></p> </xsl:when> <xsl:when test="count(ancestor::book-part) = 7"> <p style="font-size: 12; font-family:Helvetica; margin-left:100px; "><span style="color:#333399" ><xsl:value-of select="book-part-id" /></span> <span style="color:#408080" ><xsl:value-of select="title-group/label" /></span> <xsl:value-of select="title-group/title" /> <span style="color:brown;"><xsl:value-of select="title-group/subtitle" /></span></p> </xsl:when> <xsl:otherwise> <p><xsl:apply-templates/></p> </xsl:otherwise> </xsl:choose></xsl:template><xsl:template match="body/book-part/book-part-meta/book-part-id[@pub-id-type=doi]"> <span style="text-align: justify;margin-top: 0.5 em;font-size: 12pt;font-family: Helvetica; color:#0080C0"><xsl:apply-templates /> </span></xsl:template><xsl:template match="body/book-part/book-part-meta/title-group"> <p><span style="font-size: 18pt;font-family:Helvetica;"><span style="color:#408080;"><xsl:value-of select="label"/></span> <xsl:value-of select="title"/></span></p> <p><span style="font-size: 16pt;font-family: Helvetica; color:#993300"><xsl:value-of select="subtitle"/></span></p> <p><span style="font-size: 18pt;font-family: Helvetica; color:#006666"><xsl:value-of select="trans-title-group/trans-title"/></span></p> <p><span style="font-size: 16pt;font-family: Helvetica; color:#006666"><xsl:value-of select="trans-title-group/trans-subtitle"/></span></p> <hr style="border-style:dotted solid; color:#0080C0; height: 1px;" /></xsl:template><xsl:template match="fpage"><p style="color:#a3a3a3"><u><b>PRINT PAGES:</b></u></p> <span style="font-size: 14pt;font-family: Helvetica;"><xsl:value-of select="."/></span></xsl:template><xsl:template match="lpage"> <span style="font-size: 14pt;font-family: Helvetica;"> - <xsl:value-of select="."/></span> <p><hr style="border-style:dotted solid; color:#0080C0; height: 1px;" /></p></xsl:template><xsl:template match="p[1]"><p style="color:#a3a3a3"><u><b>ABSTRACT:</b></u></p><p align="justify" style="font-size: 12pt;font-family: Helvetica;"><xsl:apply-templates/></p></xsl:template><xsl:template match="p"><p align="justify" style="font-size: 12pt;font-family: Helvetica;"><xsl:apply-templates/></p></xsl:template><xsl:template match="kwd-group"><p style="color:#a3a3a3"><u><b>KEYWORDS:</b></u></p> <p><span style="font-size: 12pt;font-family: Helvetica;"><xsl:apply-templates/></span></p> <hr style="border-style:dotted solid; color:#0080C0; height: 1px;" /></xsl:template><xsl:template match="kwd-group/kwd"> <p><span style="font-size: 12pt;font-family: Helvetica;"><xsl:value-of select="."/></span></p></xsl:template><xsl:template match="custom-meta-group/custom-meta"><p style="color:#a3a3a3"><u><b>PAGE ORDER:</b></u></p> <p><span style="font-size: 14pt;font-family: Helvetica;"><xsl:value-of select="meta-value"/></span></p> <hr style="border-style:dotted solid; color:#0080C0; height: 1px;" /></xsl:template><xsl:template match="sup"> <span style="font-size: 12pt;font-family: Helvetica; color:red;"><sup><xsl:value-of select="."/></sup></span></xsl:template><xsl:template match="sub"> <span style="font-size: 12pt;font-family: Helvetica; color:blue;"><sub><xsl:value-of select="."/></sub></span></xsl:template><xsl:template match="italic"> <span style="font-size: 12pt;font-family: Helvetica; color:brown;"><i><xsl:value-of select="."/></i></span></xsl:template><xsl:template match="tex-math"> <font style="color:red;"><xsl:value-of select="."/></font></xsl:template></xsl:stylesheet> Thanks in advance for your suggestions and help. Regards,Raja. S sample.xml Edited June 26, 2012 by Raja1205 Link to comment Share on other sites More sharing options...
DVezina Posted June 26, 2012 Report Share Posted June 26, 2012 When you use <xsl:value-of select="title"/> you are only pulling in the text - not processing the nodes. Try: <xsl:apply-templates select="title"/> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now