[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Query regarding element context in XSL.........
Subject: Re: Query regarding element context in XSL.........
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 04 Oct 2001 19:02:39 -0400
|
Sanjeev,
You can do it using XPath by brute force, like you are trying. But really
this kind of thing is what keys are designed for.
Declare keys for the nodes you want to get back. For example, get the @type
attributes on <conversion> elements, like so:
<xsl:key name="conversion-type" match="conversion/@type" use="../@name"/>
This sets up the name on the same conversion element as a key to get back
each conversion @type node.
Then for an <element> element, you can say
<xsl:value-of select="key('conversion-type', @convert)"/>
I hope that helps,
Wendell
At 03:07 PM 10/4/01, you wrote:
Hi,
I have the following XML snippet from a JAXB schema-
<xml-java-binding-schema version="1.0-ea">
<element name="CreateCaseView" type="class" root="true"/>
<element name="partyId" type="value" convert="String"/>
<element name="stateDateTime" type="value"
convert="GregorianCalendar"/>
<conversion name="String" type="java.lang.String"/>
<conversion name="GregorianCalendar"
type="java.util.GregorianCalendar"/>
</xml-java-binding-schema>
I am trying to generate the .java file from this XML using XSL. The
point where I am stumped is mapping the convert attribute of <element>
to the name attribute of <conversion> so that I canget a line like the
following -
private hava.util.GregorianCalendar _stateDateTime;
I am using something like the following code which is not working -
<xsl:for-each
select="element[@type='value'][./@convert=../conversion/@name]">
<xsl:text> private </xsl:text>
<xsl:value-of
select="../conversion[./@convert=../conversion/@name]/@type" />
<xsl:value-of select="./@name" />
<xsl:call-template name="newline"/>
</xsl:for-each>
Please help.
Rgds,
sanjeev pai
=====
---------------------------------------------------------
!!!Have a nice day!!!
---------------------------------------------------------
__________________________________________________
Do You Yahoo!?
NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
======================================================================
Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|