Rahil,
At 09:26 PM 1/21/2005, you wrote:
Hi
then translate($string,$UPPER,$lower) will convert to lower case (at
least in the English/Latin alphabet).
Case-folding element and attribute names in an instance could be done
with a modified identity transform and the xsl:element instruction. (Ask
again if these hints are not enough to get you there.)
Forgive me for being a novice in XSLT programming but given a case where I
want to determine the existence of a @name='Abc' where $prime='ABC' (as
shown below)
----------------------------
<xsl:variable name="prime" select="document('result.xml')/Top/PrimeConcept"/>
<xsl:if test="@name = $prime">
<xsl:value-of select="@name"/>
</xsl:if>
</xsl:variable>
---------------------------
would I need to first declare some <xsl:variable> to convert both @name
and $name to either UPPER or lower-case and then compare them?
Yes, you could do this, although you wouldn't absolutely have to.
test="translate(@name,$UPPER,$lower) = translate($name,$UPPER,$lower) will
work, although it's a bit cumbersome.
Note that by doing this, you are actually changing nothing, just performing
a test. This is true even if you use variable to store the values.
Would there not be an inconsistency with its representation in their
respective xml documents then?
Not if you manage it properly.
I'm not entirely clear of how the XML file will 'communicate' with the
XSL file given that Ive changed the case of an element/attribute.
I'm not altogether sure what you're asking, but don't confuse the two
approaches:
1. Do brute-force comparisons, calling the translate() function where
necessary (cumbersome but doable)
2. Pre-process to normalize case, then do easier comparisons
Im finding the dynamic assigning and traversing process in XSL very
confusing as well. Is there a logical way of traversing through a tree to
determine the grandchild of an element albeit indirectly. So I know that
my XML file is as below
-----------------------
<DEFCONCEPT id="10180" name="Car">
<PARENT>
<CONCEPT name="Automobile" ref="10181"/>
</PARENT>
<CHILD>
<CONCEPT name="Toyota" ref="10235"/>
</CHILD>
</DEFCONCEPT >
<DEFCONCEPT id="10235" name="Toyota">
<PARENT>
<CONCEPT name="Car" ref="10180"/>
</PARENT>
<CHILD>
<CONCEPT name="Corolla" ref="10279"/>
</CHILD>
</DEFCONCEPT >
<DEFCONCEPT id="10279" name="Corolla">
<PARENT>
<CONCEPT name="Toyota" ref="10235"/>
</PARENT>
</DEFCONCEPT >
-----------------------
and I want to reach the <DEFCONCEPT name="Corolla"> from the node
<DEFCONCEPT name="Car"> because I have a query to determine the existence
of a kind_of Car 'Corolla' irrespective of the case in which it has been
written and where in the hierarchy it exists. Will this be possible using XSL?
Well, yes, although this is a graph-traversal problem. I'd ask about this
separately (there are list members who have more experience with this kind
of thing than I do, and can speak with more authority).
Requiring matches irrespective of case, here, would make the traversals
more complex, though some smart key definitions could mitigate that. I
would, however, probably be inclined to run a case-normalization
pre-process of my input just to handle this in one fell swoop. If the
graph-traversal logic can assume this has been done, it is likelier to be
much easier.
I hope this helps,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
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
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--