Subject: Re: [xsl] Can this hard-coded template be generalized? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 02 Oct 2011 19:26:23 -0400 |
I'll be looking for your book/DVD announcement.
Earlier, you mentioned the unnecessary grouping in my code. Since this is a pattern I often use, I'd like to know if there is a simpler way. Here is the reason I did the grouping :
This time, the goal is to write both buttons (complex=105 and complex=107) as before, but now to the same document.
Also, they need to be numbered sequentially starting with '1'. (The Czech language button simply reflects localization).
[By the way, the file names change rapidly from format to format. While they won't be needed later, right now the string disassembly prevents my making even more typos.]
<xsl:if test="cps:page-type($file-type) eq 'souvenir-sheet'">
<xsl:for-each-group select="../Stamp/Formats" group-by="@complex">
<xsl:variable name="file-name" select="concat(substring-after($page-name-stem,'aip/'), @complex, 's.htm')"/>
<a lang="en" class="button" href="{$file-name}">
<xsl:text>Se-tenant </xsl:text>
<xsl:value-of select="position()"/>
</a>
<a lang="cz" class="button" href="{$file-name}">
<xsl:value-of select="position()"/>
<xsl:text>. Spojky</xsl:text>
</a>
</xsl:for-each-group>
</xsl:if>
<xsl:for-each select="distinct-values(Stamp/Formats/@complex)"> <xsl:variable name="file-name" select="concat(substring-after($page-name-stem,'aip/'), ., 's.htm')"/> <a lang="en" class="button" href="{$file-name}"> <xsl:text>Se-tenant </xsl:text> <xsl:value-of select="position()"/> </a> <a lang="cz" class="button" href="{$file-name}"> <xsl:value-of select="position()"/> <xsl:text>. Spojky</xsl:text> </a> </xsl:for-each>
-- Contact us for world-wide XML consulting and instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Can this hard-coded templ, Mark | Thread | Re: [xsl] Can this hard-coded templ, Mark |
Re: [xsl] XSLT Patterns. was: Can t, Mark | Date | Re: [xsl] Can this hard-coded templ, Mark |
Month |