xsl-list
[Top] [All Lists]

RE: Another <xsl:key> problem

2005-09-27 11:03:34
This is preliminary, but helps.

__________________

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="xml"/>
        
        <xsl:key name="bookMarkStart" match="p" use="bookmark-start/@id" />
        <xsl:key name="bookMarkEnd" match="p" use="bookmark-end/@id" />
        
        <xsl:template match="root">
                <xsl:apply-templates />
        </xsl:template>
        
        <xsl:template match="p[count(. | key('bookMarkStart',
bookmark-start/@id)[1]) = 1]">
          <xsl:if test="generate-id()=generate-id(key('bookMarkStart',
bookmark-start/@id))">
                <xsl:variable name="bib_number"
select="substring(bookmark-start/@id, 4,
string-length(bookmark-start/@id))"/>
                <xsl:variable name="begin1"
select="bookmark-start[(_at_)id=concat('bib',$bib_number)]/ancestor-or-self::p"/>
                <xsl:variable name="end1"
select="../p/bookmark-end[(_at_)id=concat('bib',$bib_number)]/ancestor-or-self::p
" />
                <bib-reference>
                <xsl:attribute name="id"><xsl:value-of
select="concat('bib',$bib_number)"/></xsl:attribute>
                        <xsl:copy-of
select="($begin1/following-sibling::node()|$begin1)[(.|following-sibling::*)
[generate-id()=generate-id($end1)]]"/>
                </bib-reference>
          </xsl:if>
        </xsl:template>
</xsl:stylesheet>

__________________




-----Original Message-----
From: aaron apigo [mailto:aaronjose_apigo2001(_at_)yahoo(_dot_)com] 
Sent: Tuesday, September 27, 2005 6:40 AM
To: xsltforum
Subject: RE: [xsl] Another <xsl:key> problem

Hi,
   sorry for incomplete data.
it is supposed to be like this.
 
<xsl:template match="bookmark-start">
       <xsl:variable name="bib_number"
select="substring(@id, 4, string-length(@id))"/>
 
Other question is: why two keys; "contribution"
and "h_issue" are
identical?
 
oopps, sorry, my fault, no other reason for that, it
supposed to be "contribution" only, then i should used
it again for getting the nodes for variable "sample".
 
my another problem about that is, i don't know how can
i process the nodes for each key, e.g.,
 
<xsl:for-each select="$biblio[$contrib_sample]">
....................
</xsl:for-each>
 
is this correct?
 
regards.
aaron

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--