Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

To Findout Prime number

by babug_prg (Friar)
on Feb 08, 2008 at 06:59 UTC ( #666916=perlquestion: print w/ replies, xml ) Need Help??
</xsl:template> <xsl:template match="//PartInfo/PartNumber"> </xsl:template> <xsl:template match="//PartInfo/PartSequenceNumber"> </xsl:template> <xsl:template match="//PartInfo/PartTitle"> </xsl:template> <xsl:template match="//PartInfo/PartChapterCount"> </xsl:template> <xsl:template match="//PartInfo//PartContext/BookID"> </xsl:template> <xsl:template match="//PartInfo//PartContext/BookTitle"> </xsl:template> <xsl:template match="//IndexTerm"> {<xsl:apply-templates/>} </xsl:template> <xsl:template match="//IndexTerm//*">  <xsl:value-of select="name()"/>: <xsl:apply-templates/>  </xsl:template> <xsl:template match="ExternalRef"> <xsl:attribute name="href"><xsl:value-of select="@Address"/><xsl:apply-templates/></xsl:attribute><xsl:apply-templates/> </xsl:template> <xsl:template match="Colophon">

Colophon

<xsl:apply-templates/>

</xsl:template> <xsl:template match="//ChapterBackmatter/*position()=last()"> <xsl:apply-templates/>

© Integra Software Services Pvt. Ltd. All rights reserved.

</xsl:template> </xsl:stylesheet> [/Springer_FT.xsl] [springer.xsl] <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://dtd.cambridge.org/2002/CamML-content"> <xsl:variable name="uc" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/> <xsl:variable name="lc" select="'abcdefghijklmnopqrstuvwxyz'"/> <xsl:variable name="cc" select="'col'"/> <xsl:variable name="c" select="''"/> <xsl:variable name="xlh" select="'#'"/> <xsl:variable name="xlv" select="''"/> <xsl:template match="/"><xsl:apply-templates/></xsl:template> <xsl:template match="text()"><xsl:value-of select="."/></xsl:template> <xsl:template match="Publisher">
babug_prg has asked for the wisdom of the Perl Monks concerning the following question:

<code> <xsl:template match="PublisherName | PublisherLocation"></xsl:template> <xsl:template match="Section1/Heading">

► <xsl:variable name="c"> <xsl:value-of select="substring-after(ancestor::Body/preceding-sibling::ChapterInfo/child::ChapterNumber, 'Chapter ')"/> </xsl:variable> <xsl:variable name="cns"> <xsl:value-of select="ancestor::Body/preceding-sibling::ChapterInfo/@NumberingStyle"/> </xsl:variable> <xsl:if test="$cns='ChapterContent'"> <xsl:variable name="possec" select="parent::Section1"/> <xsl:variable name="posc" select="parent::Section1/preceding-sibling::Section1"/> <xsl:value-of select="$c"/>.<xsl:value-of select="count($possec)+count($posc)"/>  </xsl:if> <xsl:if test="$cns='ChapterContentSeparately'"> <xsl:variable name="possec" select="parent::Section1"/> <xsl:variable name="posc" select="parent::Section1/preceding-sibling::Section1"/> <xsl:value-of select="count($possec)+count($posc)"/>  </xsl:if> <xsl:if test="$cns='ContentOnly'"> <xsl:variable name="possec" select="parent::Section1"/> <xsl:variable name="posc" select="parent::Section1/preceding-sibling::Section1"/> <xsl:value-of select="count($possec)+count($posc)"/>  </xsl:if> <xsl:apply-templates/> 

</xsl:template> <xsl:template match="Section2/Heading">

► <xsl:variable name="c"> <xsl:value-of select="substring-after(ancestor::Body/preceding-sibling::ChapterInfo/child::ChapterNumber, 'Chapter ')"/> </xsl:variable> <xsl:variable name="cns"> <xsl:value-of select="ancestor::Body/preceding-sibling::ChapterInfo/@NumberingStyle"/> </xsl:variable> <xsl:variable name="possec" select="parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:if test="$cns='ChapterContent'"> <xsl:variable name="posc" select="parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section2/preceding-sibling::Section2"/> <xsl:value-of select="$c"/>.<xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>  </xsl:if> <xsl:if test="$cns='ChapterContentSeparately'"> <xsl:variable name="posc" select="parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section2/preceding-sibling::Section2"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>  </xsl:if> <xsl:if test="$cns='ContentOnly'"> <xsl:variable name="posc" select="parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section2/preceding-sibling::Section2"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>  </xsl:if> <xsl:apply-templates/>

</xsl:template> <xsl:template match="Section3/Heading">

► <xsl:variable name="c"> <xsl:value-of select="substring-after(ancestor::Body/preceding-sibling::ChapterInfo/child::ChapterNumber, 'Chapter ')"/> </xsl:variable> <xsl:variable name="cns"> <xsl:value-of select="ancestor::Body/preceding-sibling::ChapterInfo/@NumberingStyle"/> </xsl:variable> <xsl:variable name="possec" select="parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:if test="$cns='ChapterContent'"> <xsl:variable name="posc" select="parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section3/preceding-sibling::Section3"/> <xsl:value-of select="$c"/>.<xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>  </xsl:if> <xsl:if test="$cns='ChapterContentSeparately'"> <xsl:variable name="posc" select="parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section3/preceding-sibling::Section3"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>  </xsl:if> <xsl:if test="$cns='ContentOnly'"> <xsl:variable name="posc" select="parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section3/preceding-sibling::Section3"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>  </xsl:if> <xsl:apply-templates/>

</xsl:template> <xsl:template match="Section4/Heading">

► <xsl:variable name="c"> <xsl:value-of select="substring-after(ancestor::Body/preceding-sibling::ChapterInfo/child::ChapterNumber, 'Chapter ')"/> </xsl:variable> <xsl:variable name="cns"> <xsl:value-of select="ancestor::Body/preceding-sibling::ChapterInfo/@NumberingStyle"/> </xsl:variable> <xsl:variable name="possec" select="parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:if test="$cns='ChapterContent'"> <xsl:variable name="posc" select="parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section4/preceding-sibling::Section4"/> <xsl:value-of select="$c"/>.<xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>  </xsl:if> <xsl:if test="$cns='ChapterContentSeparately'"> <xsl:variable name="posc" select="parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section4/preceding-sibling::Section4"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>  </xsl:if> <xsl:if test="$cns='ContentOnly'"> <xsl:variable name="posc" select="parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section4/preceding-sibling::Section4"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>  </xsl:if> <xsl:apply-templates/>

</xsl:template> <xsl:template match="Section5/Heading">

► <xsl:variable name="c"> <xsl:value-of select="substring-after(ancestor::Body/preceding-sibling::ChapterInfo/child::ChapterNumber, 'Chapter ')"/> </xsl:variable> <xsl:variable name="cns"> <xsl:value-of select="ancestor::Body/preceding-sibling::ChapterInfo/@NumberingStyle"/> </xsl:variable> <xsl:variable name="possec" select="parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:if test="$cns='ChapterContent'"> <xsl:variable name="posc" select="parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section5/parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section5/parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section5/parent::Section4/preceding-sibling::Section4"/> <xsl:variable name="posc5" select="parent::Section5/preceding-sibling::Section5"/> <xsl:value-of select="$c"/>.<xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>.<xsl:value-of select="count($posc5)+1"/>  </xsl:if> <xsl:if test="$cns='ChapterContentSeparately'"> <xsl:variable name="posc" select="parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section5/parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section5/parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section5/parent::Section4/preceding-sibling::Section4"/> <xsl:variable name="posc5" select="parent::Section5/preceding-sibling::Section5"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>.<xsl:value-of select="count($posc5)+1"/>  </xsl:if> <xsl:if test="$cns='ContentOnly'"> <xsl:variable name="posc" select="parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section5/parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section5/parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section5/parent::Section4/preceding-sibling::Section4"/> <xsl:variable name="posc5" select="parent::Section5/preceding-sibling::Section5"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>.<xsl:value-of select="count($posc5)+1"/>  </xsl:if> <xsl:apply-templates/>

</xsl:template> <xsl:template match="Section6/Heading">

► <xsl:variable name="c"> <xsl:value-of select="substring-after(ancestor::Body/preceding-sibling::ChapterInfo/child::ChapterNumber, 'Chapter ')"/> </xsl:variable> <xsl:variable name="cns"> <xsl:value-of select="ancestor::Body/preceding-sibling::ChapterInfo/@NumberingStyle"/> </xsl:variable> <xsl:variable name="possec" select="parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:if test="$cns='ChapterContent'"> <xsl:variable name="posc" select="parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section6/parent::Section5/parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section6/parent::Section5/parent::Section4/preceding-sibling::Section4"/> <xsl:variable name="posc5" select="parent::Section6/parent::Section5/preceding-sibling::Section5"/> <xsl:variable name="posc6" select="parent::Section6/preceding-sibling::Section6"/> <xsl:value-of select="$c"/>.<xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>.<xsl:value-of select="count($posc5)+1"/>.<xsl:value-of select="count($posc6)+1"/>  </xsl:if> <xsl:if test="$cns='ChapterContentSeparately'"> <xsl:variable name="posc" select="parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section6/parent::Section5/parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section6/parent::Section5/parent::Section4/preceding-sibling::Section4"/> <xsl:variable name="posc5" select="parent::Section6/parent::Section5/preceding-sibling::Section5"/> <xsl:variable name="posc6" select="parent::Section6/preceding-sibling::Section6"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>.<xsl:value-of select="count($posc5)+1"/>.<xsl:value-of select="count($posc6)+1"/>  </xsl:if> <xsl:if test="$cns='ContentOnly'"> <xsl:variable name="posc" select="parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section6/parent::Section5/parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section6/parent::Section5/parent::Section4/preceding-sibling::Section4"/> <xsl:variable name="posc5" select="parent::Section6/parent::Section5/preceding-sibling::Section5"/> <xsl:variable name="posc6" select="parent::Section6/preceding-sibling::Section6"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>.<xsl:value-of select="count($posc5)+1"/>.<xsl:value-of select="count($posc6)+1"/>  </xsl:if> <xsl:apply-templates/>

</xsl:template> <xsl:template match="Section7/Heading">

► <xsl:variable name="c"> <xsl:value-of select="substring-after(ancestor::Body/preceding-sibling::ChapterInfo/child::ChapterNumber, 'Chapter ')"/> </xsl:variable> <xsl:variable name="cns"> <xsl:value-of select="ancestor::Body/preceding-sibling::ChapterInfo/@NumberingStyle"/> </xsl:variable> <xsl:variable name="possec" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:if test="$cns='ChapterContent'"> <xsl:variable name="posc" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/preceding-sibling::Section4"/> <xsl:variable name="posc5" select="parent::Section7/parent::Section6/parent::Section5/preceding-sibling::Section5"/> <xsl:variable name="posc6" select="parent::Section7/parent::Section6/preceding-sibling::Section6"/> <xsl:variable name="posc7" select="parent::Section7/preceding-sibling::Section7"/> <xsl:value-of select="$c"/>.<xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>.<xsl:value-of select="count($posc5)+1"/>.<xsl:value-of select="count($posc6)+1"/>.<xsl:value-of select="count($posc7)+1"/>  </xsl:if> <xsl:if test="$cns='ChapterContentSeparately'"> <xsl:variable name="posc" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/preceding-sibling::Section4"/> <xsl:variable name="posc5" select="parent::Section7/parent::Section6/parent::Section5/preceding-sibling::Section5"/> <xsl:variable name="posc6" select="parent::Section7/parent::Section6/preceding-sibling::Section6"/> <xsl:variable name="posc7" select="parent::Section7/preceding-sibling::Section7"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>.<xsl:value-of select="count($posc5)+1"/>.<xsl:value-of select="count($posc6)+1"/>.<xsl:value-of select="count($posc7)+1"/>  </xsl:if> <xsl:if test="$cns='ContentOnly'"> <xsl:variable name="posc" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/parent::Section1/preceding-sibling::Section1"/> <xsl:variable name="posc2" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/parent::Section3/parent::Section2/preceding-sibling::Section2"/> <xsl:variable name="posc3" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/parent::Section3/preceding-sibling::Section3"/> <xsl:variable name="posc4" select="parent::Section7/parent::Section6/parent::Section5/parent::Section4/preceding-sibling::Section4"/> <xsl:variable name="posc5" select="parent::Section7/parent::Section6/parent::Section5/preceding-sibling::Section5"/> <xsl:variable name="posc6" select="parent::Section7/parent::Section6/preceding-sibling::Section6"/> <xsl:variable name="posc7" select="parent::Section7/preceding-sibling::Section7"/> <xsl:value-of select="count($possec)+1"/>.<xsl:value-of select="count($posc2)+1"/>.<xsl:value-of select="count($posc3)+1"/>.<xsl:value-of select="count($posc4)+1"/>.<xsl:value-of select="count($posc5)+1"/>.<xsl:value-of select="count($posc6)+1"/>.<xsl:value-of select="count($posc7)+1"/>  </xsl:if> <xsl:apply-templates/>

</xsl:template> <xsl:template match="Para">

<xsl:apply-templates/>

</xsl:template> <xsl:template match="Literal">
<xsl:apply-templates/>
</xsl:template> <xsl:template match="Para/Emphasis@FontCategory='NonProportional'">

<xsl:apply-templates/>


</xsl:template> <xsl:template match="Emphasis@Type='Italic'"> <xsl:apply-templates/></xsl:template> <xsl:template match="Emphasis@Type='Italic'"> <xsl:apply-templates/> <xsl:choose> <xsl:when test="following-sibling::Bold"><xsl:apply-templates/></xsl:when> </xsl:choose> </xsl:template> <xsl:template match="Emphasis@Type='Bold'"> <xsl:apply-templates/> <xsl:choose> <xsl:when test="following-sibling::InternalRef1">   </xsl:when> </xsl:choose> </xsl:template> <xsl:template match="Emphasis@Type='BoldItalic'"> <xsl:apply-templates/> </xsl:template> <xsl:template match="Emphasis@Type='SmallCaps'"> <xsl:apply-templates/> </xsl:template> <xsl:template match="Superscript"> <xsl:apply-templates/> </xsl:template> <xsl:template match="Subscript"> <xsl:apply-templates/> </xsl:template> <xsl:template name="c_setRules"> <xsl:choose> <xsl:when test="tgroup/@rowsep='0' and (.//thead/row@rowsep='1' or .//tfooter/row@rowsep='1')"> <xsl:attribute name="RULES">groups</xsl:attribute> <xsl:attribute name="cellpadding">5</xsl:attribute> </xsl:when> <xsl:when test="tgroup/@colsep='1' and tgroup/@rowsep='0'"> <xsl:attribute name="RULES">cols</xsl:attribute> <xsl:attribute name="cellpadding">5</xsl:attribute> </xsl:when> <xsl:when test="tgroup/@colsep='0' and tgroup/@rowsep='0'"> <xsl:attribute name="RULES">none</xsl:attribute> <xsl:attribute name="cellpadding">5</xsl:attribute> </xsl:when> <xsl:when test="tgroup/@colsep='0' and tgroup/@rowsep='1'"> <xsl:attribute name="RULES">rows</xsl:attribute> <xsl:attribute name="cellpadding">4</xsl:attribute> </xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="entry" mode="getClass"> <xsl:variable name="needsColSep"><xsl:apply-templates select="." mode="needsColSep"/></xsl:variable> <xsl:variable name="needsRowSep"><xsl:apply-templates select="." mode="needsRowSep"/></xsl:variable> <xsl:variable name="colSep"><xsl:if test="$needsColSep = '1'"><xsl:text>rightBorder</xsl:text></xsl:if></xsl:variable> <xsl:variable name="rowSep"><xsl:if test="$needsRowSep = '1'"><xsl:text>bottomBorder</xsl:text></xsl:if></xsl:variable> <xsl:variable name="thead"><xsl:if test="parent::row/parent::thead"><xsl:text>thead</xsl:text></xsl:if></xsl:variable> <xsl:variable name="styles"> <xsl:value-of select="concat($colSep, ' ', $rowSep, ' ', $thead)"/> </xsl:variable> <xsl:value-of select="$styles"/> </xsl:template> <xsl:template match="entry" mode="needsColSep"> <xsl:variable name="colID"><xsl:value-of select="@colname"/></xsl:variable> <xsl:choose> <xsl:when test="(@colsep = '1') or (not(@colsep) and ancestor::tgroup/colspec(@colnum = $colID) and @colsep = '1') or (not(@colsep) and ancestor::tgroup/colspec(@colnum = $colID) and not(@colsep))"> <xsl:value-of select="'1'"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="'0'"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="entry" mode="needsRowSep"> <xsl:choose> <xsl:when test="(@rowsep = '1') or (not(@rowsep) and parent::row@rowsep = '1')"> <xsl:value-of select="'1'"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="'0'"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="c_TableColspan1"> <xsl:variable name="vartgroup" select="ancestor::tgroup"/> <xsl:variable name="varspanspec" select="$vartgroup/spanspec@spanname=current()/@spanname"/> <xsl:if test="$varspanspec/@namest and $varspanspec/@nameend"> <xsl:variable name="varcolumnst" select="$vartgroup/colspec@colname=$varspanspec/@namest/@colnum"/> <xsl:variable name="varcolumnend" select="$vartgroup/colspec@colname=$varspanspec/@nameend/@colnum"/> <xsl:choose> <xsl:when test="$varcolumnst and $varcolumnend"><xsl:value-of select="$varcolumnend - $varcolumnst + 1"/></xsl:when> <xsl:otherwise>1</xsl:otherwise> </xsl:choose> </xsl:if> </xsl:template> <xsl:template name="c_TableColspan2"> <xsl:variable name="vartgroup" select="ancestor::tgroup"/> <xsl:variable name="varspanspec" select="current()"/> <xsl:if test="$varspanspec/@namest and $varspanspec/@nameend"> <xsl:variable name="varcolumnst" select="$vartgroup/colspec@colname=$varspanspec/@namest/@colnum"/> <xsl:variable name="varcolumnend" select="$vartgroup/colspec@colname=$varspanspec/@nameend/@colnum"/> <xsl:choose> <xsl:when test="$varcolumnst and $varcolumnend"><xsl:value-of select="$varcolumnend - $varcolumnst + 1"/></xsl:when> <xsl:otherwise>1</xsl:otherwise> </xsl:choose> </xsl:if> </xsl:template> <xsl:template name="c_TableTR"> <xsl:if test="../@align"><xsl:attribute name="align"><xsl:value-of select="../@align"/></xsl:attribute></xsl:if> <xsl:choose> <xsl:when test="../@valign"><xsl:attribute name="valign"><xsl:value-of select="../@valign"/></xsl:attribute></xsl:when> <xsl:when test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign"/></xsl:attribute></xsl:when> </xsl:choose> <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute></xsl:if> </xsl:template> <xsl:template name="c_TableTD"> <xsl:variable name="colname"><xsl:value-of select="@colname"/></xsl:variable> <xsl:variable name="styles"> <xsl:variable name="temp"><xsl:apply-templates select="." mode="getClass"/></xsl:variable> <xsl:value-of select="normalize-space($temp)"/> </xsl:variable> <xsl:variable name="colWidth"> <xsl:choose> <xsl:when test="@colwidth"><xsl:value-of select="@colwidth"/></xsl:when> <xsl:otherwise><xsl:value-of select="ancestor::tgroup/colspec@colnum = $colname/@colwidth"/></xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="width"><xsl:value-of select="$colWidth"/></xsl:variable> <xsl:if test="$styles != ''"><xsl:attribute name="class">docTableCell <xsl:value-of select="$styles"/></xsl:attribute></xsl:if> <xsl:choose> <xsl:when test="@align"> <xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute></xsl:when> <xsl:when test="ancestor::tgroup/@align"><xsl:attribute name="align"><xsl:value-of select="ancestor::tgroup/@align"/></xsl:attribute></xsl:when> </xsl:choose> <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign"/></xsl:attribute></xsl:if> <xsl:if test="@morerows"><xsl:attribute name="rowspan"><xsl:value-of select="@morerows + 1"/></xsl:attribute></xsl:if> <xsl:if test="@spanname"><xsl:attribute name="colspan"><xsl:call-template name="c_TableColspan1"/></xsl:attribute></xsl:if> <xsl:if test="@namest"><xsl:attribute name="colspan"><xsl:call-template name="c_TableColspan2"/></xsl:attribute></xsl:if> <xsl:choose> <xsl:when test="child::text()"><xsl:apply-templates select="."/></xsl:when> <xsl:when test="child::*"><xsl:apply-templates/></xsl:when> <xsl:otherwise> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="c_Table">

<xsl:choose> <xsl:when test="@frame = 'all'"><xsl:attribute name="class">allBorders</xsl:attribute> <xsl:attribute name="border">1</xsl:attribute> <xsl:call-template name="c_setRules"/> </xsl:when> <xsl:when test="@frame='none'"> <xsl:attribute name="FRAME">void</xsl:attribute> <xsl:call-template name="c_setRules"/> </xsl:when> <xsl:when test="@frame='topbot'"> <xsl:attribute name="FRAME">hsides</xsl:attribute> <xsl:call-template name="c_setRules"/> </xsl:when> <xsl:when test="@frame='sides'"> <xsl:attribute name="FRAME">border</xsl:attribute> <xsl:call-template name="c_setRules"/> </xsl:when> <xsl:when test="@frame='top'"> <xsl:attribute name="FRAME">above</xsl:attribute> <xsl:call-template name="c_setRules"/> </xsl:when> <xsl:when test="@frame='bottom'"> <xsl:attribute name="FRAME">below</xsl:attribute> <xsl:call-template name="c_setRules"/> </xsl:when> <xsl:otherwise> <xsl:attribute name="border">1</xsl:attribute> <xsl:call-template name="c_setRules"/> </xsl:otherwise> </xsl:choose> <xsl:choose> <xsl:when test=".//colspec/@colwidth"/> <xsl:when test="ancestor::orderedlist1|ancestor::itemizedlist1"> <xsl:choose> <xsl:when test="ancestor::procedure1"> <xsl:attribute name="width">85%</xsl:attribute> </xsl:when> <xsl:when test="ancestor::glossdef"> <xsl:attribute name="width">85%</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:attribute name="width">90%</xsl:attribute> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test="ancestor::partintro1"><xsl:attribute name="width">90%</xsl:attribute></xsl:when> <xsl:when test="ancestor::note1|ancestor::sidebar1"><xsl:attribute name="width">90%</xsl:attribute></xsl:when> <xsl:when test="ancestor::procedure1"><xsl:attribute name="width">90%</xsl:attribute></xsl:when> <xsl:when test="ancestor::glossdef"><xsl:attribute name="width">85%</xsl:attribute></xsl:when> <xsl:otherwise><xsl:attribute name="width">100%</xsl:attribute></xsl:otherwise> </xsl:choose> <xsl:for-each select="tgroup"> <xsl:if test="@align"><xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute></xsl:if> <xsl:if test="@valign"><xsl:attribute name="valign"><xsl:value-of select="@valign"/></xsl:attribute></xsl:if> <xsl:if test="@cols"><xsl:attribute name="span"><xsl:value-of select="@cols"/></xsl:attribute></xsl:if> <xsl:for-each select="colspec"> <xsl:if test="@colwidth"> <xsl:attribute name="width"><xsl:call-template name="c_colwidth"><xsl:with-param name="attrval" select="@colwidth"/></xsl:call-template></xsl:attribute> </xsl:if> <xsl:if test="@align"> <xsl:attribute name="align"><xsl:value-of select="@align"/></xsl:attribute> </xsl:if> </xsl:for-each> <xsl:for-each select="thead/row"> <xsl:call-template name="c_TableTR"/> <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute><xsl:value-of select="''"/></xsl:if> <xsl:for-each select="entry"> </xsl:for-each> </xsl:for-each> <xsl:for-each select="tbody/row"> <xsl:call-template name="c_TableTR"/> <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute><xsl:value-of select="''"/></xsl:if> <xsl:for-each select="entry"> </xsl:for-each> </xsl:for-each> <xsl:for-each select="tfooter"> <xsl:call-template name="c_TableTR"/> <xsl:if test="@id"><xsl:attribute name="name"><xsl:value-of select="@id"/></xsl:attribute><xsl:value-of select="''"/></xsl:if> <xsl:for-each select="SimplePara"> </xsl:for-each> </xsl:for-each> </xsl:for-each>
<xsl:choose> <xsl:when test="@align"><xsl:attribute name="style">text-align:<xsl:value-of select="@align"/></xsl:attribute></xsl:when> <xsl:when test="ancestor::tgroup/@align"><xsl:attribute name="style">text-align:<xsl:value-of select="ancestor::tgroup/@align"/></xsl:attribute></xsl:when> </xsl:choose> <xsl:call-template name="c_TableTD"/>
<xsl:call-template name="c_TableTD"/>
<xsl:call-template name="c_TableTD"/>
<xsl:if test="creditline">

<xsl:apply-templates select="creditline"/>

</xsl:if> <xsl:if test="source">

<xsl:apply-templates select="source"/>

</xsl:if> <xsl:if test="mediaobject/textobjectnot(@role='alt')"> <xsl:apply-templates select="mediaobject/textobjectnot(@role='alt')"/> </xsl:if>


<xsl:for-each select=".//footnote"><xsl:apply-templates/></xsl:for-each> </xsl:template> <xsl:template name="c_Tablefooter"> <xsl:for-each select="tfooter/SimplePara">

<xsl:text>Tfooter </xsl:text><xsl:apply-templates/>

</xsl:for-each> </xsl:template> <xsl:template name="c_colwidth"> <xsl:param name="attrval"/> <xsl:value-of select="round($attrval)"/> </xsl:template> <xsl:template match="entry"> <xsl:choose> <xsl:when test="*"><xsl:apply-templates/></xsl:when> <xsl:when test="normalize-space(.)=''"> </xsl:when> <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="//Chapter/ChapterInfo/ChapterCopyright/CopyrightHolderName"></xsl:template> <xsl:template match="//Chapter/ChapterInfo/ChapterCopyright/CopyrightYear"></xsl:template> <xsl:template match="//Part">

PartInfo

<xsl:apply-templates/>
</xsl:template> <xsl:template match="//PartInfo"> <xsl:apply-templates/>
</xsl:template> <xsl:template match="//PartInfo/PartID">
<xsl:text>PartID</xsl:text> <xsl:apply-templates/>
<xsl:text>PartNumber</xsl:text> <xsl:apply-templates/>
<xsl:text>PartSequenceNumber</xsl:text> <xsl:apply-templates/>
<xsl:text>PartTitle</xsl:text> <xsl:apply-templates/>
<xsl:text>PartChapterCount</xsl:text> <xsl:apply-templates/>
<xsl:text>PartContext-BookID</xsl:text> <xsl:apply-templates/>
<xsl:text>PartContext-BookTitle</xsl:text> <xsl:apply-templates/>
<img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\svlogo2.gif"/> Springer XML Viewer

Header and References
<img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\Logo.gif"/>



Publisher Name:<xsl:value-of select="//*/PublisherName"/>
Publisher Location:<xsl:value-of select="//*/PublisherLocation"/>
<xsl:apply-templates/>
</xsl:template> <xsl:template match="Series">

Series ID:<xsl:value-of select="//*/SeriesID"/>
Series Print ISSN:<xsl:value-of select="//*/SeriesPrintISSN"/>
Series Title:<xsl:value-of select="//*/SeriesTitle"/>
Series Sub Title:<xsl:value-of select="//*/SeriesSubTitle"/>
Series Abbreviated Title:<xsl:value-of select="//*/SeriesAbbreviatedTitle"/>
<xsl:apply-templates/>
</xsl:template> <xsl:template match="Book">

Book ID:<xsl:value-of select="//*/BookID"/>
Book Title:<xsl:value-of select="//*/BookTitle"/>
Book Sub Title:<xsl:value-of select="//*/BookSubTitle"/>
Book Volume Number:<xsl:value-of select="//*/BookVolumeNumber"/>
Book DOI:<xsl:value-of select="//*/BookDOI"/>
Book Title ID:<xsl:value-of select="//*/BookTitleID"/>
Book Print ISBN:<xsl:value-of select="//*/BookPrintISBN"/>
Book Electronic ISBN:<xsl:value-of select="//*/BookElectronicISBN"/>
Book Chapter Count<xsl:value-of select="//*/BookChapterCount"/>
Copyright Holder:<xsl:value-of select="//*/CopyrightHolderName"/>  <xsl:value-of select="//*/CopyrightYear"/>
BookBackmatter Pages:<xsl:value-of select="//*/BookBackmatterFirstPage"/> – <xsl:value-of select="//*/BookBackmatterLastPage"/>
BookFrontmatter Pages:<xsl:value-of select="//*/BookFrontmatterFirstPage"/> – <xsl:value-of select="//*/BookFrontmatterLastPage"/>
<xsl:apply-templates/>
</xsl:template> <xsl:template match="Part">

Part:<xsl:value-of select="//*/PartID"/>  Part Number:  <xsl:value-of select="//*/PartNumber"/>  Part Sequence Number:  <xsl:value-of select="//*/PartSequenceNumber"/>
Part Title:<xsl:value-of select="//*/PartTitle"/>
Part SubTitle:<xsl:value-of select="//*/PartSubTitle"/>
Part Chapter Count:<xsl:value-of select="//*/PartChapterCount"/>
<xsl:apply-templates/>
</xsl:template> <xsl:template match="Chapter">

Chapter:<xsl:value-of select="@ChapterType"/>  Chapter ID:  <xsl:value-of select="//*/ChapterID"/>  Chapter Number:  <xsl:value-of select="//*/ChapterNumber"/>  Chapter Sequence Number:  <xsl:value-of select="//*/ChapterSequenceNumber"/>
Chapter Title:<xsl:value-of select="//*/ChapterTitle"/>
Chapter SubTitle:<xsl:value-of select="//*/ChapterSubTitle"/>
Chapter Pages:<xsl:value-of select="//*/ChapterFirstPage"/> – <xsl:value-of select="//*/ChapterLastPage"/>
Chapter Copyright:<xsl:value-of select="//*/ChapterCopyright/CopyrightHolderName"/>  <xsl:value-of select="//*/ChapterCopyright/CopyrightYear"/>
Copyright Year:<xsl:value-of select="//article-meta/copyright-year"/>
<xsl:apply-templates/>
</xsl:template> <xsl:template match="BodyRef">
Body Ref:<xsl:value-of select="//*/BodyRef/@FileRef"/>
OutputMedium:  <xsl:value-of select="//*/BodyRef/@OutputMedium"/>  PDFType:  <xsl:value-of select="//*/BodyRef/@PDFType"/>
<xsl:apply-templates/>
</xsl:template> <xsl:template match="//*/ChapterCopyright/CopyrightYear|//*/ChapterCopyright/CopyrightHolderName|//*/PublisherName|//*/PublisherLocation|//*/SeriesID|//*/SeriesPrintISSN|//*/SeriesTitle|//*/BookID|//*/BookTitle|//*/BookVolumeNumber|//*/BookDOI|//*/BookTitleID|//*/BookPrintISBN|//*/BookElectronicISBN|//*/BookChapterCount|//*/CopyrightHolderName|//*/CopyrightYear|ChapterID|ChapterNumber|ChapterSequenceNumber|//*/ChapterTitle|//*/ChapterFirstPage|//*/ChapterLastPage|//*/BookBackmatterFirstPage|//*/BookBackmatterLastPage|//*/BookFrontmatterFirstPage|//*/BookFrontmatterLastPage|//*/BookSubTitle|//*/PartChapterCount|//*/PartSubTitle|//*/PartTitle|//*/PartNumber|//*/PartSequenceNumber|//*/PartID|//*/ChapterSubTitle|//*/SeriesAbbreviatedTitle|//*/SeriesSubTitle"></xsl:template> <xsl:template match="SeriesHeader">

Series Header


<xsl:apply-templates/>
</xsl:template> <xsl:template match="BookHeader">

Book Header


<xsl:apply-templates/>
</xsl:template> <xsl:template match="PartHeader">

Part Header


<xsl:apply-templates/>
</xsl:template> <xsl:template match="ChapterHeader">

Chapter Header


<xsl:apply-templates/>
</xsl:template> <xsl:template match="EditorGroup">Editor Group
<xsl:apply-templates/></xsl:template> <xsl:template match="AuthorGroup">Author Group
<xsl:apply-templates/></xsl:template> <xsl:template match="Editor|Author"> <xsl:attribute name="href">#<xsl:value-of select="@AffiliationIDS"/></xsl:attribute> <xsl:apply-templates/> </xsl:template> <xsl:template match="Editor/EditorName|Author|AuthorName">

<xsl:apply-templates/>

</xsl:template> <xsl:template match="GivenName"> <xsl:apply-templates/></xsl:template> <xsl:template match="GivenName1"><xsl:apply-templates/></xsl:template> <xsl:template match="FamilyName"> <xsl:apply-templates/></xsl:template> <xsl:template match="Suffix"> <xsl:apply-templates/></xsl:template> <xsl:template match="Affiliation"> <xsl:attribute name="name"><xsl:value-of select="@ID"/></xsl:attribute>


<xsl:apply-templates/>

------------------------</xsl:template> <xsl:template match="OrgName">

Organisation Name: <xsl:apply-templates/>

</xsl:template> <xsl:template match="OrgDivision">

Organisation Division: <xsl:apply-templates/>

</xsl:template> <xsl:template match="OrgAddress/Street">

Street: <xsl:apply-templates/>

</xsl:template> <xsl:template match="OrgAddress/City">

City: <xsl:apply-templates/>

</xsl:template> <xsl:template match="OrgAddress/State">

State: <xsl:apply-templates/>

</xsl:template> <xsl:template match="OrgAddress/Country">

Country: <xsl:apply-templates/>

</xsl:template> <xsl:template match="Bibliography">
<xsl:apply-templates/> </xsl:template> <xsl:template match="Heading">

<xsl:apply-templates/>

</xsl:template> <xsl:template match="Citation"> <xsl:value-of select="@ID"/>

<xsl:apply-templates/>


</xsl:template> <xsl:template match="Citation/*/ArticleTitle"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="Citation/*/BookTitle"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="Citation/*/ChapterTitle"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="BibAuthorName"> <xsl:apply-templates select="FamilyName"/>, <xsl:apply-templates select="Initials"/> </xsl:template> <xsl:template match="BibAuthorName/Initials"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="BibAuthorName/FamilyName"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="InstitutionalAuthorName"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="BibEditorName"> <xsl:apply-templates/> </xsl:template> <xsl:template match="BibEditorName/Initials"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="BibEditorName/FamilyName"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="Citation/*/PublisherName"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="Citation/*/PublisherLocation"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="JournalTitle"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="Year"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> (<xsl:apply-templates/>) <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="VolumeID"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="IssueID"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:apply-templates/> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> <xsl:template match="FirstPage"> <xsl:apply-templates/> </xsl:template> <xsl:template match="BibUnstructured">

<xsl:apply-templates/>

</xsl:template> <xsl:template match="Emphasis@Type='Italic'"> <xsl:apply-templates/> </xsl:template> <xsl:template match="Superscript"> <xsl:apply-templates/> </xsl:template> <xsl:template match="Subscript"> <xsl:apply-templates/> </xsl:template> <xsl:template match="Particle"> <xsl:text> </xsl:text><xsl:apply-templates/> </xsl:template> <xsl:template match="Prefix"> <xsl:apply-templates/><xsl:text> </xsl:text> </xsl:template> <xsl:template match="LastPage"> -<xsl:apply-templates/> </xsl:template> <xsl:template match="Eds"> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\starttag.gif"></img> <xsl:if test="count(preceding-sibling::BibEditorName) > 1">(Eds.)</xsl:if> <xsl:if test="count(preceding-sibling::BibEditorName) = 1">(Ed.)</xsl:if> <img src="D:\Springer_FullText\Demo_FIles_Preparation\Springer_Header_References\Tools\endtag.gif"></img> </xsl:template> </xsl:stylesheet> [/springer.xsl] [check.ent] <!ENTITY ape "≊" > <!ENTITY apE "≊" > <!ENTITY apid "≋" > <!ENTITY asymp "≍" > <!ENTITY bcong "≌" > <!ENTITY bepsi "" > <!ENTITY bowtie "⋈" > <!ENTITY bsim "∽" > <!ENTITY bsime "⋍" > <!ENTITY bsolhsub "" > <!ENTITY bump "≎" > <!ENTITY bumpe "≏" > <!ENTITY bumpE "" > <!ENTITY Barv "" > <!ENTITY cire "≗" > <!ENTITY colone "≔" > <!ENTITY congdot "" > <!ENTITY csub "" > <!ENTITY csube "" > <!ENTITY csup "" > <!ENTITY csupe "" > <!ENTITY Cuepr "⋞" > <!ENTITY cuesc "⋟" > <!ENTITY Colon "∷" > <!ENTITY Colone "" > <!ENTITY dashv "⊣" > <!ENTITY Dashv "" > <!ENTITY easter "≛" > <!ENTITY ecir "≖" > <!ENTITY ecolon "≕" > <!ENTITY eDDot "" > <!ENTITY eDot "≑" > <!ENTITY efDot "≒" > <!ENTITY eg "" > <!ENTITY egs "⋝" > <!ENTITY egsdot "" > <!ENTITY el "" > <!ENTITY els "⋜" > <!ENTITY elsdot "" > <!ENTITY equest "≟" > <!ENTITY equivDD "" > <!ENTITY erDot "≓" > <!ENTITY esdot "≐" > <!ENTITY esim "≂" > <!ENTITY Esim "" > <!ENTITY fork "⋔" > <!ENTITY forkv "" > <!ENTITY frown "⌢" > <!ENTITY gap "≳" > <!ENTITY gel "⋛" > <!ENTITY ges "" > <!ENTITY gescc "" > <!ENTITY gesdot "" > <!ENTITY gesdoto "" > <!ENTITY gesdotol "" > <!ENTITY gesl "" > <!ENTITY gesles "" > <!ENTITY gE "≧" > <!ENTITY gEl "⋛" > <!ENTITY gl "≷" > <!ENTITY gla "" > <!ENTITY glE "" > <!ENTITY glj "" > <!ENTITY gsim "≳" > <!ENTITY gsime "" > <!ENTITY gsiml "" > <!ENTITY gtcc "" > <!ENTITY gtcir "" > <!ENTITY gtdot "⋗" > <!ENTITY gtquest "" > <!ENTITY gtrarr "" > <!ENTITY Gg "⋙" > <!ENTITY Gt "≫" > <!ENTITY homtht "∻" > <!ENTITY lap "≲" > <!ENTITY lat "" > <!ENTITY late "" > <!ENTITY lates "" > <!ENTITY leg "⋚" > <!ENTITY les "" > <!ENTITY lescc "" > <!ENTITY lesdot "" > <!ENTITY lesdoto "" > <!ENTITY lesdotor "" > <!ENTITY lesg "" > <!ENTITY lesges "" > <!ENTITY lE "≦" > <!ENTITY lEg "⋚" > <!ENTITY lg "≶" > <!ENTITY lgE "" > <!ENTITY lsim "≲" > <!ENTITY lsime "" > <!ENTITY lsimg "" > <!ENTITY ltcc "" ><!--UE35

Comment on To Findout Prime number
Re: To Findout Prime number
by GrandFather (Cardinal) on Feb 08, 2008 at 07:15 UTC

    And the question is?


    Perl is environmentally friendly - it saves trees
Re: To Findout Prime number
by hipowls (Curate) on Feb 08, 2008 at 07:19 UTC

    It is difficult to comment without knowing what the function is supposed to do. As far as I can tell it prints out all the numbers less than 1,000 that are not divisible by 2, 3, 5 or 7.

    Now just for fun

    use 5.010_000; say for grep { ( $_ % 2 && $_ % 3 && $_ % 5 && $_ % 7 ) } 2 .. 1_000;

Re: To Findout Prime number
by poolpi (Hermit) on Feb 08, 2008 at 07:38 UTC

    See Abigail one-liners here

    ;)
    #Abigail perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/' %% #Abigail perl -wle 'print "Prime" if (0 x shift) !~ m 0^\0?$|^(\0\0+?)\1+$0' %% #Abigail perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
    Thanks Abigail !

    PooLpi
    'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

      perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'

      OK so I thought i'd elaborate a little on how this works since the monks from the chatterbox took time to explain it to me :)

      So you have a number, say 6, and "write" it as a sequence of 1 ie (111111) .
      If you write it (11)(11)(11) "you just found that 6 = 3 * 2", as moritz explained it.

      ELISHEVA explains the math behind this :
      if there is a repeating group of the same number of ones, then a factorization is possible and hence the number can't be prime.

      It means that if you can write the number as M groups of K ones, then it factorizes as :

      M * [ Sum(p=1->k) 1 ] which really is just M * K

      Which means that our number can be divided by M (or K), and therefore it's not prime. Shmem gives an example: i.e. for m = 1763, the group found would be 11111111111111111111111111111111111111111 repeated 43 times - not prime

      So how does the regexp implement that ? We can decompose it like this :

      m/ ^ # start of line 1? # the number 1, zero or one time $ # end of line | # alternation ^ # start of line ( # remember the match in \1 11+? # the number 1, then the number 1 once or more t +imes, but the less time possible ) # \1+ # the matched sequence, once or more. $ /x ;
      So the real trick is in (11+?). In a standalone context, it will only match 11. That's because +? means "once or more but the minimum number of times". On the other hand, ^(11+?)$ will match a whole sequence of ones from begining to end.

      Here (11+?) is followed by \1+$ which means : itself, once or more, until the end of the line .
      So what happens is that the "minimum number of times" that's contained in +? is seen from the \1+$ that is after it in the expression
      So when no match occurs, the engine will go back to the (11+?) and try again.

      I understand that's what backtracking is. Eventually the regexp engine will try every grouping of ones and fine none.
      Since it needs at least two groupings to match (enforced by the + in \1+ ), a prime number will not match.

      The only problem is that for some numbers you get a Complex regular subexpression recursion limit (32766) exceeded error. My guess was that it happens when the engine has to try more than 32766 number of times, ie the first fail appears for a number that needs K>32766. That's not the case though, since prime number 32779 does not yield the error. 65558 does, though. I went on and brutforced it, to find that the error appears first with 65536, which is 2 * 32768, which computes since it needs two groups to match...

Re: To Findout Prime number
by andreas1234567 (Vicar) on Feb 08, 2008 at 08:30 UTC
    merlyn wrote an interesting column that uses the classic Sieve of Eratosthenes for finding primes. It includes clever use of the vec operator. Omitting the print it finds all primes below 1 million in 10 seconds on a mediocre i386:
    $ time perl -w use strict; my $UPPER = 1_000_000; my $sieve = ""; GUESS: for (my $guess = 2; $guess <= $UPPER; $guess++) { next GUESS if vec($sieve,$guess,1); #print "$guess\n"; for (my $mults = $guess * $guess; $mults <= $UPPER; $mults += $guess +) { vec($sieve,$mults,1) = 1; } } __END__ real 0m10.003s user 0m2.191s sys 0m0.003s
    There's an interesting animation here that shows how the algorithm works.

    See also Math::Prime::XS.

    --
    Andreas

      It includes clever use of the vec operator.

      Maybe there's historical reasons for using vec over substr, but nowadays it's much faster to use substr. The for my $foo ($from .. $to) { ... } construct is also slightly more efficiently than for (my $foo = $from; $foo <= $to; $foo++) { ... }. My guess is that the C-style loop was used as the "range loop" wasn't optimized back then and actually generated a list of, in this case, a million numbers.

      I changed the for loop and did a direct translation to using substr instead of vec, and here's the results:

      Benchmark: running substr, vec for at least 60 CPU seconds... substr: 61 wallclock secs (62.41 usr + 0.02 sys = 62.42 CPU) @ 1 +.09/s (n=68) vec: 58 wallclock secs (60.64 usr + 0.02 sys = 60.66 CPU) @ 0 +.73/s (n=44) s/iter vec substr vec 1.38 -- -33% substr 0.918 50% --
      Here's the code:
      use strict; use warnings; use Benchmark qw(cmpthese timethese); my %subs; ###################################################################### +######### my $UPPER = 1_000_000; $subs{vec} = sub { my $sieve = ""; GUESS: for my $guess (2 .. $UPPER) { next GUESS if vec($sieve,$guess,1); #print "$guess\n"; for (my $mults = $guess * $guess; $mults <= $UPPER; $mults += +$guess) { vec($sieve,$mults,1) = 1; } } }; $subs{substr} = sub { my $sieve = '0' x ($UPPER + 1); GUESS: for my $guess (2 .. $UPPER) { next GUESS if substr($sieve,$guess,1); #print "$guess\n"; for (my $mults = $guess * $guess; $mults <= $UPPER; $mults += +$guess) { substr($sieve,$mults,1,1); } } }; ###################################################################### +######### cmpthese(timethese(-60, \%subs));

      lodin

        nowadays it's much faster to use substr
        I re-ran your benchmark on Linux 2.6.9 i686, perl v5.8.5 built for i386-linux-thread-multi. The difference was much less than what you encountered.
        $ perl -w 666965.pl Benchmark: running substr, vec for at least 60 CPU seconds... substr: 67 wallclock secs (60.69 usr + 0.03 sys = 60.72 CPU) @ 0 +.58/s (n=35) vec: 66 wallclock secs (61.33 usr + 0.04 sys = 61.37 CPU) @ 0 +.54/s (n=33) s/iter vec substr vec 1.86 -- -7% substr 1.73 7% --
        On Linux 2.6.22-10-386 i686, perl v5.10.0 (different hardware than above):
        Benchmark: running substr, vec for at least 60 CPU seconds... substr: 62 wallclock secs (61.69 usr + 0.05 sys = 61.74 CPU) @ 0 +.44/s (n=27) vec: 61 wallclock secs (60.81 usr + 0.05 sys = 60.86 CPU) @ 0 +.39/s (n=24) s/iter vec substr vec 2.54 -- -10% substr 2.29 11% --
        Update Mon Feb 11 12:13:38 CET 2008: Added perl 5.10 benchmark on lodin's request.
        --
        Andreas

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://666916]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2014-12-18 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (51 votes), past polls