xsl-list
[Top] [All Lists]

RE: two questions

2003-05-23 12:23:18
1) I have an XML doc that has several non-distinct
values under one distinct element.

<dsml:attr name="cn"><dsml:value>David 
Godbey</dsml:value><dsml:value>David J
Godbey</dsml:value><dsml:value>David J 
Godbey-1</dsml:value><dsml:value>dgodbey</dsml:value></dsml:attr>

What I need to do is figure out a way to access the
node that has the "-1" in it. I would like to do this
in a template rule, i.e.

<xsl:apply-templates select="dsml:attr[(_at_)name='cn']???"
/>

but I have no idea how to do that. Can I do that? If
not, how else can I get to that value?

<xsl:apply-templates select="dsml:attr[(_at_)name='cn']/
    dsml:value[contains(., '-1')]" />

2) I have an element that contains a list of values
separated by a comma "," and then a colon ":"

<dsml:attr name="userClass">
<dsml:value>Organization: CI-1, Employer:
SAICIS</dsml:value></dsml:attr>

Again, I would like to somehow make a template rule to
access both of these as separate templates, i.e. 

<xsl:apply-templates
select="dsml:attr[(_at_)name='userClass']???" />

but I have no idea how to do that. Can I do that? If
not, how else can I get to that value?

I'm not sure what you want to do ...
Do you want to select a <dsml:value> node whose
Organization is "CI-1", for example?

<xsl:apply-templates select="dsml:attr[(_at_)name='userClass']/
  dsml:value[contains(., 'Organization: CI-1')]" />

Or do you want a template that matches any <dsml:value>
and extracts the field/value pairs like
('Organization', 'CI-1')
('Employer', 'SASCIS') etc.
?

Lars


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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