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

Re: Traverse XML Source

Subject: Re: Traverse XML Source
From: "cking" <cking@xxxxxxxxxx>
Date: Tue, 17 Aug 2004 23:23:35 +0200
xsl template match
Hi Karl,

there are a few problems with your XSL source:
it contains two templates with the same match attribute
  <xsl:template match="*">
which basically means: match any element.
Template match attributes should be unique, otherwise the 
processor does not know which of the two templates to use.

further, your second template has no effect, because match="@*"
means: match any attribute, and your XML source tree doesn't
have any element with attributes.

you didn't show us the output you expect, but something like:

<xsl:template match="/stuff/abc/def">
  <ul><xsl:apply-templates/></ul>
</xsl:template>

<xsl:template match="path | web | uid | pwd">
  <li><xsl:value-of select="."/></li>
</xsl:template>

will (hopefully) give you this output:

<ul>
  <li>\\path-to-server</li>
  <li>http://my-web-path</li>
  <li>9999</li>
  <li>monkeysee</li>
</ul>

HTH,
Anton Triest

Tuesday, August 17, 2004 10:46 PM, karl@xxxxxxxxxxxxxxxxxxxx wrote:
>
> Hello,
> I would like a very simple XSLT transformation that traverses an XML
> source and creates an HTML list output.  Is this an identity
> transformation?
> So far, I have only been able to get anything to happen on the document
> root, and nothing below is traversed.
> Thanks for the help.  ~karl
> 
> Here is what I have so far,
> XML Source:
> <stuff>
> <abc>
> <def>
> <path>\\path-to-server</path>
> <web>http://my-web-path</web>
> <uid>9999</uid>
> <pwd>monkeysee</pwd>
> </def>
> </abc>
> </stuff>
> 
> XSL Source:
> <xsl:template match="*">
>   <xsl:copy>
>     <xsl:apply-templates select="@*" />
>     <xsl:apply-templates />
>   </xsl:copy>
> </xsl:template>
> 
> 
> <xsl:template match="@*">
>   <li><xsl:copy-of select="." /></li>
> </xsl:template>
> 
> <xsl:template match="*">
>   <li><xsl:copy-of select="." /></li>
> </xsl:template>
> 
> </xsl:stylesheet>

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.