You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Dane Foster <df...@equitytg.com> on 2000/11/15 17:41:04 UTC

XPath help

Hello all.  I'm new to XPath and the transformation aspect of XML and as such, I'm unaware of any best practices techniques.  So, I'm trying to find out if there is a better and/or faster way to find out if an element exist.  If it does, I want to print out some text along with it's value, and if it doesn't, then do nothing.  Any recommendations will be appreciated

<!-- Style sheet fragment -->

<td align="center" width="336">

<font face="Lucida Sans Unicode, Verdana, Tahoma, Courier New, Courier" size="-1">

<!-- XSLT starts here -->

<b><xsl:value-of select="state"/><xsl:if test="boolean(../secHeader/executiveCountry )">, <xsl:value-of select="executiveCountry"/></xsl:if></b>

<!-- XSLT ends here-->

</font>

<br /><font face=" Courier New, courier" size="-1">State or other jurisdiction of incorporation or organization)</font>

</td>

<!-- End fragment -->


<!-- XML source fragment -->
<SB2-description-xml-document>

<secHeader>

<formType>SB2</formType>

<company>Equity Technology Group Inc.</company>

<state>Florida</state>

<sic>8900</sic>

<ein>00-1234567</ein>

<executiveAddress>530 S. Federal Highway Suite 150</executiveAddress>

<executiveCity>Deerfield Beach</executiveCity>

<executiveState>Florida</executiveState>

<executiveZip>33441</executiveZip>

<!-- The executiveCountry element may or may not appear. It's schema representation is: &lt;xsd:elment name="executiveCountry" type="xsd:string" minOccurs="0" maxOccurs="1"/&gt;-->

<executiveCountry>England</executiveCountry>

<executivePhone>954.360.9800</executivePhone>

<principalAddress>530 S. Federal Highway Suite 150</principalAddress>

<principalCity>Deerfield Beach</principalCity>

<principalState>Florida</principalState>

<principalZip>33441</principalZip>

<principalPhone>954.360.9800</principalPhone>

<agent-for-service>Billy Bob Law Services</agent-for-service>

<agentAddress>8632 S. Sutton Dr</agentAddress>

<agentCity>Miramar</agentCity>

<agentState>New England</agentState>

<agentZip>88747</agentZip>

<agentPhone>305-698-7744</agentPhone>

</secHeader>

</SB2-description-xml-document>

<!-- end XML source fragment -->


Dane Foster