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

xsl:apply-templates in combination with xsl:choose

Subject: xsl:apply-templates in combination with xsl:choose
From: Stefanie Haupt <st.haupt@xxxxxxxxx>
Date: Wed, 26 Aug 2009 13:57:02 +0200
 xsl:apply-templates in combination with xsl:choose
Hi!

I'm stuck on a problem quite a while now and am glad for help.
I'm trying to convert multiple input documents. They are have a highly
different structure so I'm trying to let xslt divide them before they
get processed further (using oxygenxml with built-in SAXON8B). 

I have a xml which holds the list of documents this way:
<filesystem>
 <file>filename1.xml</file>
 <file>filename2.xml</file>
 <file>filename3.xml</file>
 <file>filename4.xml</file>
</filesystem>

and a xsl that matches first on filesystem, gives a list of the files
and then I try to separate the files depending on something the contain
or not:

<xsl:template match="filesystem">
.....

<xsl:choose>
 <xsl:when
test="file/document(.)/xh:html/xh:head/xh:link/attribute::rel[contains(.,'stylesheet')]">
   <xsl:apply-templates select="file" mode="neuerTest"/>
 </xsl:when>

 <xsl:when
test="file/document(.)/xh:html/xh:head/xh:title[contains(.,'Mag')]">
  <xsl:apply-templates select="file" mode="#default"/>
 </xsl:when>
</xsl:choose> 

</xsl:template>

<xsl:template match="file" mode="neuerTest">
...
<xsl:template>

<xsl:template match="file" mode="#default">
...
<xsl:template>

The problem is that the first 'when' always turns true. So all files are
processed using the first argument. I tried testing for the other type
in first place and got the same result: The test I place first is always
true even if I made sure that in the documents to be processed the
things I test for are exclusive. Type B doesn't have a stylesheet
attribute and type A never contains 'Mag' in title. 

There must be a syntactical error or am I using this at the wrong place?
There must be something evident that I am missing. Can you please help
me? I tried to keep this mail short if I left out something important,
please drop me a line.

Many thanks for any help!
Stefanie

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.