xsl-list
[Top] [All Lists]

Re: [xsl] Generating attributes from the position of an element

2010-06-02 03:22:55
Dear All,

Thanks for your answers, Michael I tried it out and it worked,
however, I have not so far managed to install Saxon to my Mac, so as a
temporal solution I am using a Firefox adds-on, called "Get XSLT
results" and it has two options for creating transformations, one is
the Saxon 9B, and the other one is called "Built-in XSLT", if I am
trying with the Saxon 9B option, it does not generate the id for this

</xsl:template>
    <xsl:template match="@ID">
            <xsl:attribute name="xml:id">w.<xsl:number
count="w"/></xsl:attribute>

</xsl:template>

while the built-in option does, is it somehow related to Saxon 9B? or
alternatively it might be also the problem of this adds-on-

Thanks,

Gabor

On Tue, Jun 1, 2010 at 9:29 AM, Michael Kay <mike(_at_)saxonica(_dot_)com> 
wrote:

I have the following xml file and wish to generate ID-s based on the
position to the<w>  elements with the following XSL file, however, the
end result of the ID attribute is always 1, I have no idea why.



The reason the value is always 1 is that the @ID attribute is always at
position 1 in the list of nodes selected by

<xsl:apply-templates select="@*|node()|comment()|processing-instruction()"/>

If you want the position in the source tree of the parent element of the @ID
attribute, try<xsl:number/>.

Michael Kay
Saxonica Limited



--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--