I don't tink youve really described how the relationship between the
attributes works but this does
I want the first two @n values to be "1" and then "2",
at least.
David
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="xml" indent="no" encoding="utf-8" media-type="text/xml"
doctype-public="-//TEI P4//DTD Main Document Type//EN"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template
match="ptr[matches(@target,'([a-z]{3})\.([0-9]+)\.([0-9s]+)\.([0-9]+)[tf]m+?')]">
<ptr target="{(_at_)target}">
<xsl:attribute name="n">
<xsl:choose>
<xsl:when
test="matches(@target,'([a-z]{3})\.([0-9]+)\.([0-9s]+)\.([0-9]+)[f]m+?')">
<xsl:number from="div1" level="any"
count="ptr[matches(@target,'([a-z]{3})\.([0-9]+)\.([0-9s]+)\.([0-9]+)[f]m+?')]"/>
</xsl:when>
<xsl:otherwise>
<xsl:number from="div1" level="any"
count="ptr[matches(@target,'([a-z]{3})\.([0-9]+)\.([0-9s]+)\.([0-9]+)[t]m+?')]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</ptr>
</xsl:template>
</xsl:stylesheet>
$ saxon9 fm.xml fm.xsl
<?xml version="1.0" encoding="utf-8"?><root>
<div1><!--Article-->
<ptr target="ids.27.3.1fm" n="1"/>
<ptr target="ids.27.3.2fm" n="2"/>
<div2><!--Subsection-->
<ptr target="ids.27.3.3fm" n="3"/>
<ptr target="ids.27.3.4fm" n="4"/>
</div2>
<div2><!--Notes-->
<ptr target="ids.27.3.1tm" n="1"/>
<ptr target="ids.27.3.2tm" n="2"/>
<ptr target="ids.27.3.3tm" n="3"/>
<ptr target="ids.27.3.4tm" n="4"/>
</div2>
</div1>
<div1><!--Article-->
<ptr target="ids.27.3.3fm" n="1"/>
<ptr target="ids.27.3.4fm" n="2"/>
<div2><!--Notes-->
<ptr target="ids.27.3.3tm" n="1"/>
<ptr target="ids.27.3.4tm" n="2"/>
</div2>
</div1>
<test><ptr/></test>
</root>
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--