xsl-list
[Top] [All Lists]

[xsl] Interrogating attributes values to get text

2009-03-19 18:39:54
I could use help with problem that I just don't seem to have the programming chops to conquer. I don't have template for anyone to analyze, I can't seem to get to that state. I'm using XSL 1.0.

Here is my conundrum:

I have an element <HYPERTEXT>, that has an attribute called "linkend". The value of "linkend" corresponds to an ID attribute on an element further up the tree (preceding). This element is named <nameloc>. This element has a child, <nmlist>. My goal is to convert <HYPERTEXT> to <link> (easy enough). But my problem is I can't seem to write an expression (xsl:if? xsl:when?) to can go find the <nameloc> element that has the corresponding ID, then get the text of <nmlist> as the value of an "item" attribute on <link>.

The following are just snippets of XML. The entire tree structure should be irrelevant. Also, the <nameloc> and <nmlist> elements are eliminated in the results (not converted or output).

Current XML:

<document>
   <nameloc id="M05-08.-HT2">
       <nmlist nametype="element" dtdorlpd="REAR" docorsub="APPX-F"
       elemtype="ROW">item1</nmlist>
   </nameloc>


<STEP>
                   <HYPERTEXT linkend="M05-08.-HT2">Service
                   air cleaner assembly.</HYPERTEXT>
               </STEP>
</document>
The result I need to create is this:

<step>Service  air cleaner assembly.<link item="item1"></step>

How do I write a test will get me text of <nmlist> based on the comparison of "linkend" and "id"?

Thanks.

C. Flanders


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>