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

Re: not simple (or simple? :-) xpath matching

Subject: Re: not simple (or simple? :-) xpath matching
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Thu, 7 Jun 2001 12:51:01 -0700 (PDT)
complicated xslt matching
Hi Daniel,

If I understand you well, you might use something like the following:

Your xml document will now be the following:
-------------------------------------------
<document>
   <part name="intro">
      <chapter name="why" default="yes"/>
      <chapter name="xslt"/>
      <chapter name="is"/>
      <chapter name="so"/>
      <chapter name="complicated"/>
   </part>
</document>


And in your stylesheet:
----------------------
<xsl:choose>
  <xsl:when test="not($chapter=/document/part[@name='$part']/chapter/@name)">
    <!-- Produce your message here -->
    <chapter name="{/document/part[@name='$part']/chapter[@default='yes']/@name}"/>
  </xsl:when>
  <xsl:otherwise>
    <!-- Your normal processing here -->
  </xsl:otherwise>
</xsl:choose>

Cheers,
Dimitre Novatchev
----------------------------

Daniel Bauke wrote:

On Thursday (Jun  7), Dimitre Novatchev wrote:

> I dont find the answer above satisfactory.
well, me too, but only because i gave a wrong example, sorry.
i messed two different things, the one i presented i need in
another structure, which i plan to use later (and i'm sure i use
your suggestions :-). 

now, i want to have a default chapter, if given is incorrect and
print a short information, that one asked for non-existent. 
like that:

<document>
   <part name="intro">
      <chapter name="why"/>
      <chapter name="xslt"/>
      <chapter name="is"/>
      <chapter name="so"/>
      <chapter name="complicated"/>
   </part>
</document>

and when i ask for '?part=intro&chapter=not, i'd like to
see the answer:

   Sorry, you asked for rather impossible chapter.
   No-one ever imagined that xslt could 'not' be complicated,
   So, read patiently 'intro' why it is :-)
   <chapter name="why"/>



__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.