XSLT might be more useful here:

JSP:
----
<c:import url="/WEB-INF/test.xml" var="xml"/>
<c:import url="/WEB-INF/test.xsl" var="xslt"/>
<x:transform xml="${xml}" xslt="${xslt}"/>

/WEB-INF/test.xml:
------------------
<a>
  <b>row1</b>
  <b>row2</b>
  <b>row3</b>
  <b>row4</b>
  <b>row5</b>
  <b>row6</b>
</a>

/WEB-INF/test.xsl:
------------------
<a xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xsl:version="1.0">
  <xsl:copy-of select="//b[position() &lt; 3]"/>
</a>

Quoting "Johnson, Chris" <[EMAIL PROTECTED]>:

> I know this isn't a purely taglib question, so just scream at me if I'm
> out of line here...
>  
> Is there a way in xpath to include the immediate parent node in the
> resulting node set?
>  
> example:
>  
> initial xml:
> <a>
>     <b>row1</b>
>     <b>row2</b>
>     <b>row3</b>
>     <b>row4</b>
>     <b>row5</b>
>     <b>row6</b>
> <a>
>  
> xpath="/a/b[position()<3]"
>  
> That will return me: 
> <b>row1</b>
> <b>row2</b>
>  
> But what I really want is:
> <a>
>     <b>row1</b>
>     <b>row2</b>
> </a>
>  
> I guess I just need to know if this is even a possibility in xpath (was
> it designed to do this?).  If not, then I can stop killing myself trying
> to figure out how.
>  
> Thanks,
>  
> Chris Johnson 
> Texas Instruments
> [EMAIL PROTECTED] 

-- 
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to