[xquery-talk] Unusual XPath syntax question

Schwartz, Christine christine.schwartz at ptsem.edu
Mon Oct 31 09:52:38 PDT 2016


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





More information about the talk mailing list