Hi Christine,

In principle, in XPath, "./." is the same as "." and returns the context item. 
There is a minor difference, in that "./." will return an error if the context 
item is not a node, but in the case of the query at hand, it should always be 
an element node. Replacing "./." with "." produced the same results on my side.

I'd definitely wait for Mike's answer before concluding on this though, because 
he'll probably see something I haven't. :-)

Kind regards,
Ghislain


> On 31 Oct 2016, at 17:52, Schwartz, Christine <[email protected]> 
> wrote:
> 
> Hi,
> 
> I'm hoping someone on this list can clarify my conundrum.
> 
> I'm working with a colleague on a writing project and one of his examples 
> uses this XPath syntax "./." in the starts-with() function within an XSLT 
> stylesheet. I don't know what "./." means. I would think that "." alone would 
> be sufficient to refer to the context node.
> 
> Here's the example: 
> 
> <xsl:for-each select="//dim:field">
>    <xsl:if test="./@element='title'">
>       <xsl:choose>
>          <xsl:when test="starts-with(./.,'The ')">
>                <datafield tag="245" ind1="1" ind2="4">
>                       <subfield code="a"><xsl:value-of 
> select="."/>.</subfield>
>                </datafield>
>          </xsl:when>
>          <xsl:when test="starts-with(./.,'An ')">
>                <datafield tag="245" ind1="1" ind2="3">
>                       <subfield code="a"><xsl:value-of 
> select="."/>.</subfield>
>                </datafield>
>          </xsl:when>
>          <xsl:when test="starts-with(./.,'A ')">
>                <datafield tag="245" ind1="1" ind2="2">
>                       <subfield code="a"><xsl:value-of 
> select="."/>.</subfield>
>                </datafield>
>          </xsl:when>
>          <xsl:otherwise>
>               <datafield tag="245" ind1="1" ind2="0">
>                     <subfield code="a"><xsl:value-of select="."/>.</subfield>
>               </datafield>
> Thanks, 
> 
> Chris
> 
> Christine Schwartz
> Metadata Librarian and XML Database Administrator
> Princeton Theological Seminary
> Library
> P.O. Box 821
> Princeton, NJ 08542
> [email protected]
> (609) 497-7938
> 
> 
> 
> _______________________________________________
> [email protected]
> http://x-query.com/mailman/listinfo/talk





_______________________________________________
[email protected]
http://x-query.com/mailman/listinfo/talk

Reply via email to