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

getting stuck in context when using substring-before a

Subject: getting stuck in context when using substring-before as test
From: "Miller, Mark" <Mark.Miller@xxxxxxxxxxxxxxxx>
Date: Tue, 24 Nov 2009 13:40:40 -0500
 getting stuck in context when using substring-before a
I have the following simplified xml file that I am transforming into an
HTML table.  In the table I have a cell where I am placing three date
values in an embedded table.  I am having trouble using the
substring-before as a test to find the specific element that matches and
then getting that elements data.  This case is very simple, there will
be many Objects with 0 to 5 bObjRef elements, each of which will have
its own cell with 3 date values displayed.

Any guidance is greatly appreciated,


Start Simple.xml...........................
<ematrix>
    <creationProperties>
       <datetime>2009-11-24T07:12:50Z</datetime>
    </creationProperties>
    <Object>
        <oname>Name001 (some text here)</oname>
        <desc>description</desc>
        <aList>
            <attr>
                <name>Due Customer</name>
                <datetime>2009-08-10T00:00:00Z</datetime>
            </attr>
            <attr>
                <name>Submitted Date</name>
                <datetime>2009-08-10T00:00:00Z</datetime>
            </attr>
            <attr>
                <name>POC</name>
                <string>lastname</string>
            </attr>
            <attr>
                <name>Submittal Revision</name>
                <string>-</string>
            </attr>
            <attr>
                <name>Comments</name>
                <string>comments</string>
            </attr>
        </aList>
        <fRelList>
            <rel>
                <rRefDef>Subordinate Submittal</rRefDef>
                <rObj>
                    <bObjRef>
                        <oType>Submittal</oType>
                        <oName>BMC4I-DD-04-06k-2010-08</oName>
                    </bObjRef>
                </rObj>
                <attrList>
                    <attr>
                        <name>Due Customer</name>
                        <datetime>2010-08-08T00:00:00Z</datetime>
                    </attr>
                    <attr>
                        <name>Promised</name>
                        <datetime>2010-08-08T00:00:00Z</datetime>
                    </attr>
                    <attr>
                        <name>Submitted</name>
                        <datetime>2010-08-07T00:00:00Z</datetime>
                    </attr>
                </attrList>
            </rel>
            <rel>
                <rRefDef>Subordinate Submittal</rRefDef>
                <rObj>
                    <bObjRef>
                        <oType>Submittal</oType>
                        <oName>CMR-DD-04-06k-2010-08</oName>
                    </bObjRef>
                </rObj>
                <attrList>
                    <attr>
                        <name>Due Customer</name>
                        <datetime>2009-08-10T00:00:00Z</datetime>
                    </attr>
                    <attr>
                        <name>Promised</name>
                        <datetime/>
                    </attr>
                    <attr>
                        <name>Submitted</name>
                        <datetime>2009-08-11T00:00:00Z</datetime>
                    </attr>
                </attrList>
            </rel>
            <rel>
                <rRefDef>Subordinate Submittal</rRefDef>
                <rObj>
                    <bObjRef>
                        <oType>Submittal</oType>
                        <oName>DD-LR-IPT-GE-04-06k-2010-08</oName>
                    </bObjRef>
                </rObj>
                <attrList>
                    <attr>
                        <name>Due Customer</name>
                        <datetime>2010-08-09T00:00:00Z</datetime>
                    </attr>
                    <attr>
                        <name>Promised</name>
                        <datetime/>
                    </attr>
                    <attr>
                        <name>Submitted</name>
                        <datetime>2010-08-12T00:00:00Z</datetime>
                    </attr>
                </attrList>
            </rel>
        </fRelList>
    </Object>
</ematrix>
End simple.xml...............................

Start simple.xsl...............................
<?xml version=3D"1.0" encoding=3D"iso-8859-1"?> <!DOCTYPE xsl:stylesheet
[
<!ENTITY nbsp   "&#160;">
]>
<xsl:stylesheet version=3D"1.0"
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform">
  <xsl:output method=3D"html" encoding=3D"iso-8859-1"/>
  <xsl:template match=3D"/">
   =20
    <html>
      <head> </head>
    <body> =20
      <table border=3D"1">
        <tr>
          <th><div align=3D'center'>BMC4I</div></th>
        </tr>
        <tr>
        <xsl:for-each select=3D"ematrix/Object">
          <xsl:if
test=3D"substring-before(fRelList/rel/rObj/bObjRef/oName,'BMC4I-')">
            <td>
              <table border=3D"0">
                <tr>
                  <td><xsl:value-of
select=3D"substring(aList/attr[name=3D'Due
Customer']/datetime,1,10)"/>&nbsp;</td>
                </tr>
                <tr>
                  <td><xsl:value-of
select=3D"substring(aList/attr[name=3D'Promised']/datetime,1,10)"/>&nbsp
;=
</t
d>
                </tr>
                <tr>
                  <td><xsl:value-of
select=3D"substring(aList/attr[name=3D'Submitted']/datetime,1,10)"/>&nbs
p=
;</
td>
                </tr>
              </table>
            </td>
            </xsl:if>
          </xsl:for-each>
        </tr>
      </table>
      </body>
      </html>   =20
  </xsl:template>
</xsl:stylesheet>
End simple.xsl............................
Start simple.htm..........................
<html>
   <head>
   <table border=3D"1">
      <tr >
         <th>
            <div align=3D"center">BMC4I</div>
         </th>
      </tr>
      <tr>
         <td>
            <table border=3D"0" >
               <tr>
                  <td>2010-08-08</td>
               </tr>
               <tr>
                  <td>2010-08-08</td>
               </tr>
               <tr>
                  <td>2010-08-07</td>
               </tr>
            </table>
         </td>
      </tr>
   </table>
<body>
End simple.htm....................................


Mark J. Miller

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-2011 All Rights Reserved.