Subject: [xsl] Help Required on position() From: "Pankaj Bishnoi" <pankaj.bishnoi@xxxxxxxxxxx> Date: Mon, 9 Jul 2007 18:27:42 +0530 |
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) = '1.1']"/> <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),'Executive Summary' )]"/> <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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Apple Adds exslt:node-set, M. David Peterson | Thread | [xsl] csv to xml converter bug, Andrew Welch |
Re: [xsl] Preserving Spaces and Tab, Florent Georges | Date | [xsl] csv to xml converter bug, Andrew Welch |
Month |