XSLT: Display value if similar in two different nodes (data from TEI-XML)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

XSLT: Display value if similar in two different nodes (data from TEI-XML)

Vanessa Juloux
Dear all,

I am a beginner in XSLT. 
Please, apologize for my lack of good explanation in English…

I would like to display a value of @xml:id if its value is equal to the same value in another node.
So I have tried to use <xsl:if> but it doesn’t work. Maybe it is not the right choice. Since the code is long, I have added a section of my XSL file on Github: 
https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl

The section of the TEI file:
<!-- XPATH: /teiCorpus/teiHeader[1]/encodingDesc[1]/classDecl[1]/taxonomy[2]/category[4]/category[9] -->
<category n="9" xml:id="verb.motion" ana="#verb.category #action">
 <catDesc>taxonomy: motion verbs</catDesc>
  <category n="1" xml:id="meeting" ana="#verb.motion">
   <catDesc>subcategory of motion's verb as a concept: meeting
    <!-- additional content within <lang></lang> --> 
   </catDesc>
  <category ana="#transcription" xml:lang="uga">
   <equiv n="1" xml:id="qry"/> 
  </category>
</category>

<!-- section that gave me trouble to find data in XSLT -->
<!-- XPATH /teiCorpus/text[1]/body[1]/div1[2]/div2[2]/div3[2]/div4[2]/lg[1]/l[1]/w[2] -->
<w type="verb" ana="#qry #yQTL" xml:id="ktu1-3_ii_l4b-5a_tqry">
<!-- more content -->
<w type="verb" ana="#qry #yQTL" xml:id="ktu1-4_ii_l10_qryt_tqry">

For example: If category/equiv[@xml:id] and w[@type='verb' and @ana[1]] = 'qry'(always first value of @ana), display "href" of @xml:id of element 'w'. 

I have no problem with first "select='following-sibling::category/equiv[@n]’." I have what I want. Unfortunately for "select="//w[@type='verb’]"," what I have tried doesn't work: instead of a similar "href" of an @xml:id, I have ALL "href" and first value of @ana.

But unfortunately, I have all @xml:id and "href", and not only the one which are similar:
qry: ktu1-3_ii_l4b-5a_tqryklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġddktu1-3_ii_l5b-6a_tmtḫṣklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġdd ktu1-3_ii_l6b_tḫtṣb

What I’m looking to display in browser:
qry: ktu1-3_ii_l4b-5a 'tqry', ktu1-4_ii_l10 'qrty' 

Explanation : ktu1-3_ii_l4b-5a is the value of @xml:id WITHOUT content after the last special character ‘_’ , and ‘tqry’ and ‘qrty’ are the inflected for of the verb ‘qry’ always after the last ‘_’. 
So I have also tried in xsl (second problem):
<xsl:value-of select="[not(contains(substring-after-last('_’))]"/>
But it’s not working…

In advance, thank you for your kind help. 

Vanessa
---

Vanessa Juloux | Ph.D. candidate
» Chair Membership and Outreach Sub-committee for Europe (American Schools of Oriental Research)
Mobile + WhatsApp: +33 (0) 6 98 97 02 02 Academiavanessajuloux.xyz
Reply | Threaded
Open this post in threaded view
|

Re: XSLT: Display value if similar in two different nodes (data from TEI-XML)

Peter Stadler
Hi Vanessa,

I just took a quick look and it seems that in line 43 and 44 you probably should not test/select for „//w…“ (which does walk down from the document node to every <w> again) but instead for the current context, i.e. a simple dot „.“ or current().

Hope that helps
Peter
 

> Am 15.12.2017 um 15:26 schrieb Vanessa Juloux <[hidden email]>:
>
> Dear all,
>
> I am a beginner in XSLT.
> Please, apologize for my lack of good explanation in English…
>
> I would like to display a value of @xml:id if its value is equal to the same value in another node.
> So I have tried to use <xsl:if> but it doesn’t work. Maybe it is not the right choice. Since the code is long, I have added a section of my XSL file on Github: https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl
>
> The section of the TEI file:
> <!-- XPATH: /teiCorpus/teiHeader[1]/encodingDesc[1]/classDecl[1]/taxonomy[2]/category[4]/category[9] -->
> <category n="9" xml:id="verb.motion" ana="#verb.category #action">
>  <catDesc>taxonomy: motion verbs</catDesc>
>   <category n="1" xml:id="meeting" ana="#verb.motion">
>    <catDesc>subcategory of motion's verb as a concept: meeting
>     <!-- additional content within <lang></lang> -->
>    </catDesc>
>   <category ana="#transcription" xml:lang="uga">
>    <equiv n="1" xml:id="qry"/>
>   </category>
> </category>
>
> <!-- section that gave me trouble to find data in XSLT -->
> <!-- XPATH /teiCorpus/text[1]/body[1]/div1[2]/div2[2]/div3[2]/div4[2]/lg[1]/l[1]/w[2] -->
> <w type="verb" ana="#qry #yQTL" xml:id="ktu1-3_ii_l4b-5a_tqry">
> <!-- more content -->
> <w type="verb" ana="#qry #yQTL" xml:id="ktu1-4_ii_l10_qryt_tqry">
>
> For example: If category/equiv[@xml:id] and w[@type='verb' and @ana[1]] = 'qry'(always first value of @ana), display "href" of @xml:id of element 'w'.
>
> I have no problem with first "select='following-sibling::category/equiv[@n]’." I have what I want. Unfortunately for "select="//w[@type='verb’]"," what I have tried doesn't work: instead of a similar "href" of an @xml:id, I have ALL "href" and first value of @ana.
>
> But unfortunately, I have all @xml:id and "href", and not only the one which are similar:
> qry: ktu1-3_ii_l4b-5a_tqryklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġddktu1-3_ii_l5b-6a_tmtḫṣklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġdd ktu1-3_ii_l6b_tḫtṣb…
>
> What I’m looking to display in browser:
> qry: ktu1-3_ii_l4b-5a 'tqry', ktu1-4_ii_l10 'qrty'
>
> Explanation : ktu1-3_ii_l4b-5a is the value of @xml:id WITHOUT content after the last special character ‘_’ , and ‘tqry’ and ‘qrty’ are the inflected for of the verb ‘qry’ always after the last ‘_’.
> So I have also tried in xsl (second problem):
> <xsl:value-of select="[not(contains(substring-after-last('_’))]"/>
> But it’s not working…
>
> In advance, thank you for your kind help.
>
> Vanessa
> ---
>
> Vanessa Juloux | Ph.D. candidate
> » Ecole Pratique des Hautes Etudes  (EPHE), Paris Sciences et Lettres (PSL) University
> » Chair Membership and Outreach Sub-committee for Europe (American Schools of Oriental Research)
> Mobile + WhatsApp: +33 (0) 6 98 97 02 02 Academia, vanessajuloux.xyz
Reply | Threaded
Open this post in threaded view
|

Re: XSLT: Display value if similar in two different nodes (data from TEI-XML)

Vanessa Juloux
Thank you Peter!
I have tried to follow your suggestion, and I also '(text)’:
<xsl:if test="current()"><xsl:value-of select="current()[text()]"/></xsl:if>
It is of course better, since I don’t have all the list ‘text()’, but unfortunately I still don’t have only similar values.

Instead, I’ve got: 
"//w[@type='verb'and @ana[1]]" and "preceding::category/equiv/@*[namespace-uri()='http://www.w3.org/XML/1998/namespace' and local-name()='id’]" CAN have a same value.

So I have tried with <xsl:when> with a little reframe, new update at https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl
But I’m not satisfied: 
Except for two occurrences, they are not equal, since I don’t have:
qry: tqry (ktu1-3_ii_l4b-5a_tqry) , qrty (ktu1-4_ii_l10_qrty)  (in red above)

Vanessa


Le 15 déc. 2017 à 16:42, Peter Stadler <[hidden email]> a écrit :

Hi Vanessa,

I just took a quick look and it seems that in line 43 and 44 you probably should not test/select for „//w…“ (which does walk down from the document node to every <w> again) but instead for the current context, i.e. a simple dot „.“ or current().

Hope that helps
Peter

Am 15.12.2017 um 15:26 schrieb Vanessa Juloux <[hidden email]>:

Dear all,

I am a beginner in XSLT.
Please, apologize for my lack of good explanation in English…

I would like to display a value of @xml:id if its value is equal to the same value in another node.
So I have tried to use <xsl:if> but it doesn’t work. Maybe it is not the right choice. Since the code is long, I have added a section of my XSL file on Github: https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl

The section of the TEI file:
<!-- XPATH: /teiCorpus/teiHeader[1]/encodingDesc[1]/classDecl[1]/taxonomy[2]/category[4]/category[9] -->
<category n="9" xml:id="verb.motion" ana="#verb.category #action">
<catDesc>taxonomy: motion verbs</catDesc>
 <category n="1" xml:id="meeting" ana="#verb.motion">
  <catDesc>subcategory of motion's verb as a concept: meeting
   <!-- additional content within <lang></lang> -->
  </catDesc>
 <category ana="#transcription" xml:lang="uga">
  <equiv n="1" xml:id="qry"/>
 </category>
</category>

<!-- section that gave me trouble to find data in XSLT -->
<!-- XPATH /teiCorpus/text[1]/body[1]/div1[2]/div2[2]/div3[2]/div4[2]/lg[1]/l[1]/w[2] -->
<w type="verb" ana="#qry #yQTL" xml:id="ktu1-3_ii_l4b-5a_tqry">
<!-- more content -->
<w type="verb" ana="#qry #yQTL" xml:id="ktu1-4_ii_l10_qryt_tqry">

For example: If category/equiv[@xml:id] and w[@type='verb' and @ana[1]] = 'qry'(always first value of @ana), display "href" of @xml:id of element 'w'.

I have no problem with first "select='following-sibling::category/equiv[@n]’." I have what I want. Unfortunately for "select="//w[@type='verb’]"," what I have tried doesn't work: instead of a similar "href" of an @xml:id, I have ALL "href" and first value of @ana.

But unfortunately, I have all @xml:id and "href", and not only the one which are similar:
qry: ktu1-3_ii_l4b-5a_tqryklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġddktu1-3_ii_l5b-6a_tmtḫṣklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġdd ktu1-3_ii_l6b_tḫtṣb…

What I’m looking to display in browser:
qry: ktu1-3_ii_l4b-5a 'tqry', ktu1-4_ii_l10 'qrty'

Explanation : ktu1-3_ii_l4b-5a is the value of @xml:id WITHOUT content after the last special character ‘_’ , and ‘tqry’ and ‘qrty’ are the inflected for of the verb ‘qry’ always after the last ‘_’.
So I have also tried in xsl (second problem):
<xsl:value-of select="[not(contains(substring-after-last('_’))]"/>
But it’s not working…

In advance, thank you for your kind help.

Vanessa
---

Vanessa Juloux | Ph.D. candidate
» Ecole Pratique des Hautes Etudes  (EPHE), Paris Sciences et Lettres (PSL) University
» Chair Membership and Outreach Sub-committee for Europe (American Schools of Oriental Research)
Mobile + WhatsApp: +33 (0) 6 98 97 02 02 Academia, vanessajuloux.xyz

Reply | Threaded
Open this post in threaded view
|

Re: XSLT: Display value if similar in two different nodes (data from TEI-XML)

Vanessa Juloux
Just a quick note: I have the solution, thanks to someone else. I need to use <xsl:key>.
Thanks again.
Vanessa

Le 15 déc. 2017 à 17:56, Vanessa Juloux <[hidden email]> a écrit :

Thank you Peter!
I have tried to follow your suggestion, and I also '(text)’:
<xsl:if test="current()"><xsl:value-of select="current()[text()]"/></xsl:if>
It is of course better, since I don’t have all the list ‘text()’, but unfortunately I still don’t have only similar values.

Instead, I’ve got: 
"//w[@type='verb'and @ana[1]]" and "preceding::category/equiv/@*[namespace-uri()='http://www.w3.org/XML/1998/namespace' and local-name()='id’]" CAN have a same value.

So I have tried with <xsl:when> with a little reframe, new update at https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl
But I’m not satisfied: 
Except for two occurrences, they are not equal, since I don’t have:
qry: tqry (ktu1-3_ii_l4b-5a_tqry) , qrty (ktu1-4_ii_l10_qrty)  (in red above)

Vanessa


Le 15 déc. 2017 à 16:42, Peter Stadler <[hidden email]> a écrit :

Hi Vanessa,

I just took a quick look and it seems that in line 43 and 44 you probably should not test/select for „//w…“ (which does walk down from the document node to every <w> again) but instead for the current context, i.e. a simple dot „.“ or current().

Hope that helps
Peter

Am 15.12.2017 um 15:26 schrieb Vanessa Juloux <[hidden email]>:

Dear all,

I am a beginner in XSLT.
Please, apologize for my lack of good explanation in English…

I would like to display a value of @xml:id if its value is equal to the same value in another node.
So I have tried to use <xsl:if> but it doesn’t work. Maybe it is not the right choice. Since the code is long, I have added a section of my XSL file on Github: https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl

The section of the TEI file:
<!-- XPATH: /teiCorpus/teiHeader[1]/encodingDesc[1]/classDecl[1]/taxonomy[2]/category[4]/category[9] -->
<category n="9" xml:id="verb.motion" ana="#verb.category #action">
<catDesc>taxonomy: motion verbs</catDesc>
 <category n="1" xml:id="meeting" ana="#verb.motion">
  <catDesc>subcategory of motion's verb as a concept: meeting
   <!-- additional content within <lang></lang> -->
  </catDesc>
 <category ana="#transcription" xml:lang="uga">
  <equiv n="1" xml:id="qry"/>
 </category>
</category>

<!-- section that gave me trouble to find data in XSLT -->
<!-- XPATH /teiCorpus/text[1]/body[1]/div1[2]/div2[2]/div3[2]/div4[2]/lg[1]/l[1]/w[2] -->
<w type="verb" ana="#qry #yQTL" xml:id="ktu1-3_ii_l4b-5a_tqry">
<!-- more content -->
<w type="verb" ana="#qry #yQTL" xml:id="ktu1-4_ii_l10_qryt_tqry">

For example: If category/equiv[@xml:id] and w[@type='verb' and @ana[1]] = 'qry'(always first value of @ana), display "href" of @xml:id of element 'w'.

I have no problem with first "select='following-sibling::category/equiv[@n]’." I have what I want. Unfortunately for "select="//w[@type='verb’]"," what I have tried doesn't work: instead of a similar "href" of an @xml:id, I have ALL "href" and first value of @ana.

But unfortunately, I have all @xml:id and "href", and not only the one which are similar:
qry: ktu1-3_ii_l4b-5a_tqryklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġddktu1-3_ii_l5b-6a_tmtḫṣklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġdd ktu1-3_ii_l6b_tḫtṣb…

What I’m looking to display in browser:
qry: ktu1-3_ii_l4b-5a 'tqry', ktu1-4_ii_l10 'qrty'

Explanation : ktu1-3_ii_l4b-5a is the value of @xml:id WITHOUT content after the last special character ‘_’ , and ‘tqry’ and ‘qrty’ are the inflected for of the verb ‘qry’ always after the last ‘_’.
So I have also tried in xsl (second problem):
<xsl:value-of select="[not(contains(substring-after-last('_’))]"/>
But it’s not working…

In advance, thank you for your kind help.

Vanessa
---

Vanessa Juloux | Ph.D. candidate
» Ecole Pratique des Hautes Etudes  (EPHE), Paris Sciences et Lettres (PSL) University
» Chair Membership and Outreach Sub-committee for Europe (American Schools of Oriental Research)
Mobile + WhatsApp: +33 (0) 6 98 97 02 02 Academia, vanessajuloux.xyz


Reply | Threaded
Open this post in threaded view
|

Re: XSLT: Display value if similar in two different nodes (data from TEI-XML)

Elisa Beshero-Bondar
Vanessa-- xsl:key should speed up your processing, but can you tell us how it resolved your problem, or post your new code? It could be useful to share with others working out similar issues.

I was worried about something in your emailed post, when you were reaching for @ana[1], since that by itself won't grab a first value of an attribute--but on closer inspection of your code on GitHub, it looks like you're properly tokenizing it after all! 

Cheers,
Elisa

On Fri, Dec 15, 2017 at 12:35 PM, Vanessa Juloux <[hidden email]> wrote:
Just a quick note: I have the solution, thanks to someone else. I need to use <xsl:key>.
Thanks again.
Vanessa

Le 15 déc. 2017 à 17:56, Vanessa Juloux <[hidden email]> a écrit :

Thank you Peter!
I have tried to follow your suggestion, and I also '(text)’:
<xsl:if test="current()"><xsl:value-of select="current()[text()]"/></xsl:if>
It is of course better, since I don’t have all the list ‘text()’, but unfortunately I still don’t have only similar values.

Instead, I’ve got: 
"//w[@type='verb'and @ana[1]]" and "preceding::category/equiv/@*[namespace-uri()='http://www.w3.org/XML/1998/namespace' and local-name()='id’]" CAN have a same value.

So I have tried with <xsl:when> with a little reframe, new update at https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl
But I’m not satisfied: 
Except for two occurrences, they are not equal, since I don’t have:
qry: tqry (ktu1-3_ii_l4b-5a_tqry) , qrty (ktu1-4_ii_l10_qrty)  (in red above)

Vanessa


Le 15 déc. 2017 à 16:42, Peter Stadler <[hidden email]> a écrit :

Hi Vanessa,

I just took a quick look and it seems that in line 43 and 44 you probably should not test/select for „//w…“ (which does walk down from the document node to every <w> again) but instead for the current context, i.e. a simple dot „.“ or current().

Hope that helps
Peter

Am 15.12.2017 um 15:26 schrieb Vanessa Juloux <[hidden email]>:

Dear all,

I am a beginner in XSLT.
Please, apologize for my lack of good explanation in English…

I would like to display a value of @xml:id if its value is equal to the same value in another node.
So I have tried to use <xsl:if> but it doesn’t work. Maybe it is not the right choice. Since the code is long, I have added a section of my XSL file on Github: https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl

The section of the TEI file:
<!-- XPATH: /teiCorpus/teiHeader[1]/encodingDesc[1]/classDecl[1]/taxonomy[2]/category[4]/category[9] -->
<category n="9" xml:id="verb.motion" ana="#verb.category #action">
<catDesc>taxonomy: motion verbs</catDesc>
 <category n="1" xml:id="meeting" ana="#verb.motion">
  <catDesc>subcategory of motion's verb as a concept: meeting
   <!-- additional content within <lang></lang> -->
  </catDesc>
 <category ana="#transcription" xml:lang="uga">
  <equiv n="1" xml:id="qry"/>
 </category>
</category>

<!-- section that gave me trouble to find data in XSLT -->
<!-- XPATH /teiCorpus/text[1]/body[1]/div1[2]/div2[2]/div3[2]/div4[2]/lg[1]/l[1]/w[2] -->
<w type="verb" ana="#qry #yQTL" xml:id="ktu1-3_ii_l4b-5a_tqry">
<!-- more content -->
<w type="verb" ana="#qry #yQTL" xml:id="ktu1-4_ii_l10_qryt_tqry">

For example: If category/equiv[@xml:id] and w[@type='verb' and @ana[1]] = 'qry'(always first value of @ana), display "href" of @xml:id of element 'w'.

I have no problem with first "select='following-sibling::category/equiv[@n]’." I have what I want. Unfortunately for "select="//w[@type='verb’]"," what I have tried doesn't work: instead of a similar "href" of an @xml:id, I have ALL "href" and first value of @ana.

But unfortunately, I have all @xml:id and "href", and not only the one which are similar:
qry: ktu1-3_ii_l4b-5a_tqryklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġddktu1-3_ii_l5b-6a_tmtḫṣklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġdd ktu1-3_ii_l6b_tḫtṣb…

What I’m looking to display in browser:
qry: ktu1-3_ii_l4b-5a 'tqry', ktu1-4_ii_l10 'qrty'

Explanation : ktu1-3_ii_l4b-5a is the value of @xml:id WITHOUT content after the last special character ‘_’ , and ‘tqry’ and ‘qrty’ are the inflected for of the verb ‘qry’ always after the last ‘_’.
So I have also tried in xsl (second problem):
<xsl:value-of select="[not(contains(substring-after-last('_’))]"/>
But it’s not working…

In advance, thank you for your kind help.

Vanessa
---

Vanessa Juloux | Ph.D. candidate
» Ecole Pratique des Hautes Etudes  (EPHE), Paris Sciences et Lettres (PSL) University
» Chair Membership and Outreach Sub-committee for Europe (American Schools of Oriental Research)
Mobile + WhatsApp: <a href="tel:+33%206%2098%2097%2002%2002" value="+33698970202" target="_blank">+33 (0) 6 98 97 02 02 Academia, vanessajuloux.xyz





--
Elisa Beshero-Bondar, PhD
Director, Center for the Digital Text | Associate Professor of English
University of Pittsburgh at Greensburg | Humanities Division
150 Finoli Drive
Greensburg, PA  15601  USA
E-mail:[hidden email]
Development site: http://newtfire.org
Reply | Threaded
Open this post in threaded view
|

Re: XSLT: Display value if similar in two different nodes (data from TEI-XML)

Vanessa Juloux
Thanks for your answer and precision.
 
The right answer is:

<xsl:key name="w" match="w[@type='verb']" use="tokenize(@ana, ' ')" />
## template
 <ul>
    <xsl:for-each select="following-sibling::category/equiv[@n]">
        <li>
        <!-- @uri = @xml:id in TEI -->
            <xsl:variable name="href"><xsl:value-of select="@uri"/></xsl:variable>
            <a href="{$href}">
              <xsl:value-of select="./@*[namespace-uri()='<a href="http://www.w3.org/XML/1998/namespace' and local-name()='id" class="">http://www.w3.org/XML/1998/namespace' and local-name()='id']"/></a>:
             <!-- find same value than equiv in w -->
             <xsl:for-each select="key('w', concat('#', @xml:id))">
              <!-- @xml:id in TEI -->
                 <xsl:variable name="href"><xsl:value-of select="@xml:id"/></xsl:variable>
                 <xsl:text> (</xsl:text><a href="{$href}">
                   <xsl:value-of select="./@*[namespace-uri()='<a href="http://www.w3.org/XML/1998/namespace' and local-name()='id" class="">http://www.w3.org/XML/1998/namespace' and local-name()='id']" /></a><xsl:text>)</xsl:text><!-- <xsl:if test="position() != last()"> -->
                   <xsl:if test="position() != last()">
                     <xsl:text>, </xsl:text>
                    </xsl:if>
             </xsl:for-each>
           </li>
      </xsl:for-each>
  </ul>


I have already updated the GitHub link with the right answer: https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl

Thanks again!
Cheers,
Vanessa

Le 15 déc. 2017 à 18:41, Elisa Beshero-Bondar <[hidden email]> a écrit :

Vanessa-- xsl:key should speed up your processing, but can you tell us how it resolved your problem, or post your new code? It could be useful to share with others working out similar issues.

I was worried about something in your emailed post, when you were reaching for @ana[1], since that by itself won't grab a first value of an attribute--but on closer inspection of your code on GitHub, it looks like you're properly tokenizing it after all! 

Cheers,
Elisa

On Fri, Dec 15, 2017 at 12:35 PM, Vanessa Juloux <[hidden email]> wrote:
Just a quick note: I have the solution, thanks to someone else. I need to use <xsl:key>.
Thanks again.
Vanessa

Le 15 déc. 2017 à 17:56, Vanessa Juloux <[hidden email]> a écrit :

Thank you Peter!
I have tried to follow your suggestion, and I also '(text)’:
<xsl:if test="current()"><xsl:value-of select="current()[text()]"/></xsl:if>
It is of course better, since I don’t have all the list ‘text()’, but unfortunately I still don’t have only similar values.

Instead, I’ve got: 
"//w[@type='verb'and @ana[1]]" and "preceding::category/equiv/@*[namespace-uri()='http://www.w3.org/XML/1998/namespace' and local-name()='id’]" CAN have a same value.

So I have tried with <xsl:when> with a little reframe, new update at https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl
But I’m not satisfied: 
Except for two occurrences, they are not equal, since I don’t have:
qry: tqry (ktu1-3_ii_l4b-5a_tqry) , qrty (ktu1-4_ii_l10_qrty)  (in red above)

Vanessa


Le 15 déc. 2017 à 16:42, Peter Stadler <[hidden email]> a écrit :

Hi Vanessa,

I just took a quick look and it seems that in line 43 and 44 you probably should not test/select for „//w…“ (which does walk down from the document node to every <w> again) but instead for the current context, i.e. a simple dot „.“ or current().

Hope that helps
Peter

Am 15.12.2017 um 15:26 schrieb Vanessa Juloux <[hidden email]>:

Dear all,

I am a beginner in XSLT.
Please, apologize for my lack of good explanation in English…

I would like to display a value of @xml:id if its value is equal to the same value in another node.
So I have tried to use <xsl:if> but it doesn’t work. Maybe it is not the right choice. Since the code is long, I have added a section of my XSL file on Github: https://github.com/vjuloux/draft/blob/master/display-equal-value.xsl

The section of the TEI file:
<!-- XPATH: /teiCorpus/teiHeader[1]/encodingDesc[1]/classDecl[1]/taxonomy[2]/category[4]/category[9] -->
<category n="9" xml:id="verb.motion" ana="#verb.category #action">
<catDesc>taxonomy: motion verbs</catDesc>
 <category n="1" xml:id="meeting" ana="#verb.motion">
  <catDesc>subcategory of motion's verb as a concept: meeting
   <!-- additional content within <lang></lang> -->
  </catDesc>
 <category ana="#transcription" xml:lang="uga">
  <equiv n="1" xml:id="qry"/>
 </category>
</category>

<!-- section that gave me trouble to find data in XSLT -->
<!-- XPATH /teiCorpus/text[1]/body[1]/div1[2]/div2[2]/div3[2]/div4[2]/lg[1]/l[1]/w[2] -->
<w type="verb" ana="#qry #yQTL" xml:id="ktu1-3_ii_l4b-5a_tqry">
<!-- more content -->
<w type="verb" ana="#qry #yQTL" xml:id="ktu1-4_ii_l10_qryt_tqry">

For example: If category/equiv[@xml:id] and w[@type='verb' and @ana[1]] = 'qry'(always first value of @ana), display "href" of @xml:id of element 'w'.

I have no problem with first "select='following-sibling::category/equiv[@n]’." I have what I want. Unfortunately for "select="//w[@type='verb’]"," what I have tried doesn't work: instead of a similar "href" of an @xml:id, I have ALL "href" and first value of @ana.

But unfortunately, I have all @xml:id and "href", and not only the one which are similar:
qry: ktu1-3_ii_l4b-5a_tqryklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġddktu1-3_ii_l5b-6a_tmtḫṣklʾat tqry tmtḫṣ tḫtṣ tmḫṣ tṣmt ʿtkt šnst tġll tgrš tmġyn tštql šbʿt tṯʿr ṯʿr tmtḫṣn tʿn tḫtṣb tḥdy t[d]ġdd ktu1-3_ii_l6b_tḫtṣb…

What I’m looking to display in browser:
qry: ktu1-3_ii_l4b-5a 'tqry', ktu1-4_ii_l10 'qrty'

Explanation : ktu1-3_ii_l4b-5a is the value of @xml:id WITHOUT content after the last special character ‘_’ , and ‘tqry’ and ‘qrty’ are the inflected for of the verb ‘qry’ always after the last ‘_’.
So I have also tried in xsl (second problem):
<xsl:value-of select="[not(contains(substring-after-last('_’))]"/>
But it’s not working…

In advance, thank you for your kind help.

Vanessa
---

Vanessa Juloux | Ph.D. candidate
» Ecole Pratique des Hautes Etudes  (EPHE), Paris Sciences et Lettres (PSL) University
» Chair Membership and Outreach Sub-committee for Europe (American Schools of Oriental Research)
Mobile + WhatsApp: <a href="tel:+33%206%2098%2097%2002%2002" value="+33698970202" target="_blank" class="">+33 (0) 6 98 97 02 02 Academia, vanessajuloux.xyz





--
Elisa Beshero-Bondar, PhD
Director, Center for the Digital Text | Associate Professor of English
University of Pittsburgh at Greensburg | Humanities Division
150 Finoli Drive
Greensburg, PA  15601  USA
E-mail:[hidden email]
Development site: http://newtfire.org