code template for identity transform

Dear Oxygen folks, I often find the need to insert an identity transform template into an XSLT stylesheet I'm writing, but I don't always remember the correct XPath for the match pattern and the apply-templates/@select, and it's a nuisance to have to keep looking it up. A few times I've created a code template in Oxygen for it, but it keeps disappearing as I upgrade Oxygen. Would you consider adding this code template to the built-in list for the XSL editor? It seems like it would be useful to a lot of XSL developers. Name: id Description: Identity transform. Associate with: XSL Editor. Content: <!-- Identity transform --> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> No doubt you can tweak the content if there is a more approved variation on the above. Thanks for your consideration, Lars

Dear Lars, There is already a code template that inserts the recursive copy template. Its name is "ct" so if you type ct then CTRL+Enter you should get <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template> Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 6/12/10 2:54 PM, Lars Huttar wrote:
Dear Oxygen folks,
I often find the need to insert an identity transform template into an XSLT stylesheet I'm writing, but I don't always remember the correct XPath for the match pattern and the apply-templates/@select, and it's a nuisance to have to keep looking it up.
A few times I've created a code template in Oxygen for it, but it keeps disappearing as I upgrade Oxygen. Would you consider adding this code template to the built-in list for the XSL editor? It seems like it would be useful to a lot of XSL developers.
Name: id Description: Identity transform. Associate with: XSL Editor. Content: <!-- Identity transform --> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template>
No doubt you can tweak the content if there is a more approved variation on the above.
Thanks for your consideration, Lars
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

Thank you for this. I am glad but not very surprised to see Oxygen already offers this... it usually has everything that would be commonly useful! The only thing I see lacking here is discoverability. Next time I go to use this pattern, if it's not soon, I'm not sure how I will remember to use "ct", as I do not remember hearing "copy template" or "recursive copy template" as a term for the pattern. Is it a well-known term? I've only heard of it as the "identity transformation". E.g. at http://www.w3.org/TR/xslt#copying it is referred to that way; and a yahoo search for xslt "identity transform" gives me about 100x as many results as for xslt "recursive copy template". (xslt "copy template" gives about 20x, but with many false positives.) Would it be reasonable to add "id" as a name for this code template? Thanks, Lars On 6/12/2010 2:14 PM, George Cristian Bina wrote:
Dear Lars,
There is already a code template that inserts the recursive copy template. Its name is "ct" so if you type
ct then CTRL+Enter you should get
<xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template>
Best Regards, George

I disagree here, ³id² is a named template I use on almost all of my projects and it¹s always to do with id attributes, never identity trasform templates. I personally favor ³copy² name for those. Thus I think the code template should remain unnamed by default. Cheers, Jarno On 2010-6-13 15:16, "Lars Huttar" <lars_huttar@sil.org> wrote:
Thank you for this. I am glad but not very surprised to see Oxygen already offers this... it usually has everything that would be commonly useful!
The only thing I see lacking here is discoverability. Next time I go to use this pattern, if it's not soon, I'm not sure how I will remember to use "ct", as I do not remember hearing "copy template" or "recursive copy template" as a term for the pattern. Is it a well-known term? I've only heard of it as the "identity transformation". E.g. at http://www.w3.org/TR/xslt#copying it is referred to that way; and a yahoo search for xslt "identity transform" gives me about 100x as many results as for xslt "recursive copy template". (xslt "copy template" gives about 20x, but with many false positives.)
Would it be reasonable to add "id" as a name for this code template?
Thanks, Lars
On 6/12/2010 2:14 PM, George Cristian Bina wrote:
Dear Lars,
There is already a code template that inserts the recursive copy template. Its name is "ct" so if you type
ct then CTRL+Enter you should get
<xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template>
Best Regards, George
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

How about "idt" as a name, mnemonic with "identity transform" (or "identity template"). That would be easily discoverable from the content completion list, and would not conflict with "id" for id attributes. Lars On 6/17/2010 12:28 AM, Jarno Elovirta wrote:
I disagree here, "id" is a named template I use on almost all of my projects and it's always to do with id attributes, never identity trasform templates. I personally favor "copy" name for those. Thus I think the code template should remain unnamed by default.
Cheers,
Jarno
On 2010-6-13 15:16, "Lars Huttar" <lars_huttar@sil.org> wrote:
Thank you for this. I am glad but not very surprised to see Oxygen already offers this... it usually has everything that would be commonly useful!
The only thing I see lacking here is discoverability. Next time I go to use this pattern, if it's not soon, I'm not sure how I will remember to use "ct", as I do not remember hearing "copy template" or "recursive copy template" as a term for the pattern. Is it a well-known term? I've only heard of it as the "identity transformation". E.g. at http://www.w3.org/TR/xslt#copying it is referred to that way; and a yahoo search for xslt "identity transform" gives me about 100x as many results as for xslt "recursive copy template". (xslt "copy template" gives about 20x, but with many false positives.)
Would it be reasonable to add "id" as a name for this code template?
Thanks, Lars
On 6/12/2010 2:14 PM, George Cristian Bina wrote:
Dear Lars,
There is already a code template that inserts the recursive copy template. Its name is "ct" so if you type
ct then CTRL+Enter you should get
<xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*"/> </xsl:copy> </xsl:template>
Best Regards, George
------------------------------------------------------------------------ _______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
participants (3)
-
George Cristian Bina
-
Jarno Elovirta
-
Lars Huttar