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

RE: problem with xsl:choose

Subject: RE: problem with xsl:choose
From: "Christopher R. Maden" <crism@xxxxxxxxx>
Date: Fri, 25 May 2001 03:11:29 -0700
RE:  problem with xsl:choose
At 02:19 25-05-2001, Student1 ASCO-ELK (RBJE/ELK) wrote:
unfortunately i have some book about xlst ;)

my xml file
  <screen h=2 w=3 />
  <table h=2 w=4 />

sorry, i forget to mention that, the <screen> and <table> are NOT mandatory.
the xmldocument varies
and if for example the <table> tag is not in the document i dont want the
<table name='table'> to be in the final document.

Use templates.

<xsl:template match="/">
  <xsl:if test="not(//screen) and not(//table)">
  <xsl:apply-templates select="//screen|//table"/>

<xsl:template match="screen">
  <table class=screen>
    <xsl:attribute name=tID>
      <xsl:value-of select="@h"/>
    <xsl:call-template name='screenHdr'/>
    <!-- put whatever is in your current screen template here -->

<xsl:template match="table">
  <table class=table>
    <xsl:attribute name=tID>
      <xsl:value-of select="@h"/>
    <xsl:call-template name='tableHdr'/>
    <!-- put whatever is in your current table template here -->

i cant use only the <xsl:apply-templates ... /> because i dont want the
<table ...></table> to appear in the outputfile

you know now what i mean ?

Sorry, no. Your example, if it worked, would put table tags in the output file; if you don't want them, don't generate them in your stylesheet.

Christopher R. Maden, XML Consultant
DTDs/schemas - conversion - ebooks - publishing - Web - B2B - training
<URL: http://crism.maden.org/consulting/ >
PGP Fingerprint: BBA6 4085 DED0 E176 D6D4  5DFC AC52 F825 AFEC 58DA

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

Current Thread


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.
First Name
Last Name
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.