xsl-list
[Top] [All Lists]

RE: Creating internal lists

2003-04-28 06:44:35
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  <xsl:output method="html" indent="yes" />     
  
<xsl:template match="o">
<xsl:variable name="item" select="'item'"/>
<xsl:for-each select="CITATION">
        <xsl:variable name="citationid">
                <xsl:value-of select="@id"/>
        </xsl:variable>
        <xsl:element name="{concat('item',@id)}">
        <xsl:for-each select="../CITEREF[(_at_)rid=$citationid]">
                <xsl:element name="{concat('item',@id)}"/>

        </xsl:for-each>
        </xsl:element>
</xsl:for-each>

</xsl:template>
</xsl:stylesheet>

for the xml file
<?xml version="1.0"?>
<o>
<CITATION id="c9"/>
<CITATION id="c10"/>
<CITEREF id="cr9-1" rid="c9"/>
<CITEREF id="cr9-2" rid="c10"/>
</o>

Does this help you?

sundar

-----Original Message-----
From: Shellenberger, Mark [mailto:MShellenberger(_at_)apa(_dot_)org]
Sent: Monday, April 28, 2003 6:12 PM
To: 'XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: [xsl] Creating internal lists


At least this is what I think I am trying to do.....

I am trying to take a large document and convert it into something much
smaller.  The document has a References list and then citations within the
document body.  I want to create a list where each citation in the
References is matched up with all instances of matching citation references
in the body.

The citation elements are like this:
<CITATION ID="c9">

The reference elements are like this:
<CITEREF ID="cr9-1" RID="c9">

I want the end result to be like this:

item 9
  item9-1

item10
  item10-1
  item10-2
  item10-3

item11
  item11-1
  item11-2

I am not even sure what to call this....thus looking within the FAQ/Archives
and at Developerworks, and XML.com/.org has been difficult at best.

Any suggestions or assistance is greatly appreciated.  Heck just tell me
where to read about it and I will be eternally grateful.

Thanks,
Mark


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>