aspose file tools*
The moose likes XML and Related Technologies and the fly likes How to add a new attribute via xsl in an existing xml structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to add a new attribute via xsl in an existing xml structure" Watch "How to add a new attribute via xsl in an existing xml structure" New topic
Author

How to add a new attribute via xsl in an existing xml structure

Sumit Aggarwal
Greenhorn

Joined: Jul 31, 2011
Posts: 11
Problem : I need to add a new variable DateTime(Integer type) in the current hierarchy(of dbPublish.xml) as a event attribute. For example,



Partial Solution:

I have added the code in red in dbPublish.xsl, which will give me DateTime=”20110802124026”



Now, where should I call my event template so as to put my attribute at the desired location.


Please provide your valuable inputs.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 511
    
    3
If you mean the xml document itself does not actually have DateTime attribute on its "event" element, you can do it like this, modifying the attribute template and adding one named template "DateTime" below.

You can thereby take out the template for event, and named template "FormatDate" and "FormatTime".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to add a new attribute via xsl in an existing xml structure