[xquery-talk] Unusual XPath syntax question

G. Ken Holman gkholman at CraneSoftwrights.com
Mon Oct 31 10:20:43 PDT 2016


Yes, "." is the same as "./." and the shorter version (to me) would 
be more suitable for legibility.  The shorter syntax already is being 
used in the select attribute, so I'm unclear what the author might be 
trying to gain with the longer syntax.

. . . . . . Ken

At 2016-10-31 16:52 +0000, Schwartz, Christine 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
>christine.schwartz at ptsem.edu
>(609) 497-7938
>
>
>
>_______________________________________________
>talk at x-query.com
>http://x-query.com/mailman/listinfo/talk


--
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Streaming hands-on XSLT/XPath 2 training @US$45: http://goo.gl/Dd9qBK |
Crane Softwrights Ltd. _ _ _ _ _ _ http://www.CraneSoftwrights.com/q/ |
G Ken Holman _ _ _ _ _ _ _ _ _ _ mailto:gkholman at CraneSoftwrights.com |
Google+ blog _ _ _ _ _ http://plus.google.com/+GKenHolman-Crane/posts |
Legal business disclaimers: _ _ http://www.CraneSoftwrights.com/legal |



More information about the talk mailing list