Re: Wrapping XSL around XML tags of the same name

Subject: Re: Wrapping XSL around XML tags of the same name
From: "Steve Muench" <SMUENCH@xxxxxxxxxxxxx>
Date: 05 Aug 1999 09:38:46 -0700
(note the extra slash at the end between time_n and @value...) 
 
<xsl:value-of select="journey/outbound/start_time/time_1/@value" />  
<xsl:value-of select="journey/outbound/start_time/time_2/@value" />  
<xsl:value-of select="journey/outbound/start_time/time_3/@value" />  
 
Could be: 
 
<xsl:value-of select="journey/outbound/start_time/time[1]/@value" />  
<xsl:value-of select="journey/outbound/start_time/time[2]/@value" />  
<xsl:value-of select="journey/outbound/start_time/time[3]/@value" />  
 
which is a convenient abbreviation for: 
 
<xsl:value-of select="journey/outbound/start_time/time[position() = 1]/@value" 
/>  
<xsl:value-of select="journey/outbound/start_time/time[position() = 2]/@value" 
/>  
<xsl:value-of select="journey/outbound/start_time/time[position() = 3]/@value" 
/>  
 
_________________________________________________________ 
Steve Muench, Consulting Product Manager & XML Evangelist 
Business Components for Java Dev't Team 
BC4J: http://technet.oracle.com/product/tools/appjava/info/techwp20/wp.html 
 XML: http://www.oracle.com/xml
--- Begin Message ---
Subject: Wrapping XSL around XML tags of the same name
From: johng@xxxxxxxxxxxx
Date: 05 Aug 1999 09:00:50
I'm hoping someone can shed some light on this problem.

I have to wrap an XSL style sheet around some XML which is produced from a 
stored procedure in a SQL database.  It is producing XML as shown below:

<journey>
        <outbound>
                <start_time>
                        <time value="0825"/>
                        <time value="0925"/>
                        <time value="1025"/>
                </start_time>
        </outbound>
</journey> 

My question is basically, how would I wrap XSL around the individual tags?

For example, if the output was:

<journey>
        <outbound>
                <start_time>
                        <time_1 value="0825"/>
                        <time_2 value="0925"/>
                        <time_3 value="1025"/>
                </start_time>
        </outbound>
</journey>

I could just use the following to individually access each attribute:

<xsl:value-of select="journey/outbound/start_time/time_1@value" /> 
<xsl:value-of select="journey/outbound/start_time/time_2@value" /> 
<xsl:value-of select="journey/outbound/start_time/time_3@value" /> 

How would I go about this where the time tag is not unique?

All help is greatly appreciated!

Thanks in advance

John :-)


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

--- End Message ---
Current Thread