[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Another <xsl:key> problem
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[@id=concat('bib',$bib_number)]/ancestor-or-self::p"/> <xsl:variable name="end1" select="../p/bookmark-end[@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@xxxxxxxxx] Sent: Tuesday, September 27, 2005 6:40 AM To: xsltforum Subject: RE: 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
|
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
|