[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Help Required on position()

Subject: Help Required on position()
From: "Pankaj Bishnoi" <pankaj.bishnoi@xxxxxxxxxxx>
Date: Mon, 9 Jul 2007 18:27:42 +0530
 Help Required on position()
Hi All
            I am having a requirement where i am reading table/rows based on
some predicates and i know the starting and end prediacte condition. Now i
want to get all the rows that come between these two rows(startrow and
endrow). In the xsl given below i have cretaed two variables::

varTableProjectInformation and $varEndProjectInformation

The target side project information tag should contain between the startrow
and endrow as ::

Expected Target::

<?xml version="1.0" encoding="UTF-8"?>
<Output xmlns:java="http://xml.apache.org/xslt/java"
xmlns:ns0="http://www.davisor.com/offisor/3.1/xmsw"
xmlns:str="http://exslt.org/strings"
xmlns:xalan="http://xml.apache.org/xalan">
    <ProjectInformation>
        <DocumentSection>1.1</DocumentSection>
        <SectionDescription>Project Information</SectionDescription>
        <ProjectName>New Project</ProjectName>
        <PortfolioID>204</PortfolioID>
        <SuperProcess>Information Technology Group</SuperProcess>
    </ProjectInformation>
</Output>


 MY xsl is ::


<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.1" xmlns:java="http://xml.apache.org/xslt/java"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:ns0="http://www.davisor.com/offisor/3.1/xmsw"
xmlns:str="http://exslt.org/strings"
xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
extension-element-prefixes="redirect">
     <xsl:output method="xml" version="1.0" encoding="ISO-8859-1"
indent="yes"/>
     <xsl:template match="/">
          <Output>
               <ProjectInformation>
                    <xsl:variable name="varTableProjectInformation"
select="/ns0:xmsw/ns0:body/ns0:section/ns0:table[position() =
1]/ns0:row[str:concat(ns0:cell[position() = 2]/ns0:p/ns0:c) =
&apos;1.1&apos;]"/>
                    <xsl:variable name="varEndProjectInformation"
select="/ns0:xmsw/ns0:body/ns0:section/ns0:table[position() = 1]/ns0:row[
starts-with(str:concat(ns0:cell[position() = 3]/ns0:p/ns0:c),&apos;Executive
Summary&apos; )]"/>
                    <DocumentSection>
                         <xsl:value-of
select="$varTableProjectInformation"/>
                    </DocumentSection>
                    <SectionDescription>
                         <xsl:value-of select="$varEndProjectInformation"/>
                    </SectionDescription>
                    <ProjectName></ProjectName>
                    <PortfolioID></PortfolioID>
                    <SuperProcess></SuperProcess>
                    <CouncilSubmissionDate></CouncilSubmissionDate>
               </ProjectInformation>
          </Output>
     </xsl:template>
</xsl:stylesheet>




and source xml is ::

<?xml version="1.0"?>
<xmsw xmlns="http://www.davisor.com/offisor/3.1/xmsw">

 <body>
  <section>
   <table>
    <row>
     <cell>
      <p>
       <c/>
      </p>
     </cell>
     <cell>
      <p>
       <c>1.1</c>
      </p>
     </cell>
     <cell>
      <p>
       <c>Project Information</c>
      </p>
     </cell>
    </row>
    <row>
     <cell>
      <p>
       <c/>
      </p>
     </cell>
     <cell>
      <p>
       <c/>
      </p>
     </cell>
     <cell>
      <p>
       <c>Project Name</c>
      </p>
     </cell>
     <cell>
      <p>
       <c>New Project</c>
      </p>
     </cell>
    </row>
    <row>
     <cell>
      <p>
       <c/>
      </p>
     </cell>
     <cell>
      <p>
       <c/>
      </p>
     </cell>
     <cell>
      <p>
       <c>Portfolio ID #</c>
      </p>
     </cell>
     <cell>
      <p>
       <c>204</c>
      </p>
     </cell>
    </row>
    <row>
     <cell>
      <p>
       <c/>
      </p>
     </cell>
     <cell>
      <p>
       <c/>
      </p>
     </cell>
     <cell>
      <p>
       <c>Super Process/Division</c>
      </p>
     </cell>
     <cell>
      <p>
       <c>Information Technology Group</c>
      </p>
     </cell>
    </row>
    <row>
     <cell>
      <p>
       <c/>
      </p>
     </cell>
     <cell>
      <p>
       <tabStop/>
       <c/>
       <tab>
        <c>1.2</c>
       </tab>
      </p>
     </cell>
     <cell>
      <p>
       <c/>
      </p>
      <p>
       <c>Executive Summary</c>
      </p>
      <p>
       <c/>
      </p>
     </cell>
    </row>
   </table>
  </section>
 </body>
</xmsw>


Thanks & Regards
Pankaj

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.