xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From native apache <athabaskan...@yahoo.com>
Subject Re: XPath help
Date Wed, 15 Nov 2000 20:38:32 GMT
Hello Dane,
  You can try to use <xsl:apply-templats /> and
<xsl:template match="executiveCountry>, i.e. you do
not have to use <xsl:if test="....">. 
 If there is no <executiveCountry> within <secHeader>,
<xsl:template match="exectutiveCountry"> will never be
applied.
  

e.g. 
 
  <xsl:template match="/">
  <xsl:apply-templates />
  </xsl:template>

<xsl:template match="executiveCountry">

<!-- do whatever appropriate here -->

</xsl:template>

 
--- Dane Foster <dfoster@equitytg.com> wrote:
> 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
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/

Mime
View raw message