how to access Custom Attributes

Questions about writing stylesheets for transforming (Tools > Transform Tasklist) your tasklist

Moderator: abstr

User avatar
zonfeld
Posts: 173
Joined: Sun Mar 21, 2021 11:41 am
Contact:

Re: how to access Custom Attributes

Post by zonfeld » Mon May 01, 2023 7:37 am

abstr wrote:
Mon May 01, 2023 1:27 am
zonfeld wrote:
Sun Apr 30, 2023 4:37 pm
I'm not allowed to attach XSLT files, it seems
Fixed.
Thank you!
abstr wrote:
Mon May 01, 2023 1:29 am
I'll investigate what else I need to do to support XSLT 2.0... Oh dear
Microsoft is probably too busy implementing their fabulous AI to worry about petty stuff like XSLT 2.0. :lol:

User avatar
zonfeld
Posts: 173
Joined: Sun Mar 21, 2021 11:41 am
Contact:

Re: how to access Custom Attributes

Post by zonfeld » Mon May 01, 2023 9:08 am

Well, it appears I have nothing better to do than to fiddle with XSLT. ;)

I changed the transformation so that it works with XSLT 1.0. You can use it with ToDoList if you either
  • change the file extension to ".xsl" or
  • override the file extension that ToDoList expects in the selection dialog
    ToDoList_expected_file_extension_override.jpg
I've attached the input, the transformation, and the output (HTML not allowed, so I zipped it up) to this post. Have fun!

Custom_attribute_example_2.jpg
Attachments
XSLT_1v0_Custom_attribute_handling.xslt
(3.62 KiB) Downloaded 36 times
Custom_attribute_example_2.zip
(707 Bytes) Downloaded 32 times
Custom_attribute_example_2.tdl
(6.46 KiB) Downloaded 35 times

User avatar
zonfeld
Posts: 173
Joined: Sun Mar 21, 2021 11:41 am
Contact:

Re: how to access Custom Attributes

Post by zonfeld » Mon May 01, 2023 9:46 am

Something else: I'm not sure what issue your XML editor has with HTML tags but I don't experience any problem with every other tool I can get my hands on. ToDoList seems to handle them well, too. Therefore, here's a "simple" version of the transformation without xsl:element and xsl:attribute, which is much easier to read.

PS: It seems that Jaxe requires that for every top-level HTML element the XHTML namespace is provided. I don't know why it would do that but I've created another file, which satisfies this requirement. Note the changes similar to this:

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml">
Jaxe_file_comparison_report.jpg
Attachments
XSLT_1v0_Custom_attribute_handling_simple.xslt
(2.73 KiB) Downloaded 32 times
XSLT_1v0_Custom_attribute_handling_simple_jaxe.xslt
(2.88 KiB) Downloaded 31 times

ispyridis
Posts: 95
Joined: Fri Apr 07, 2023 7:05 pm

Re: how to access Custom Attributes

Post by ispyridis » Mon May 01, 2023 2:16 pm

@zonfeld you really nailed it !!!

before even I started to understand what you uploaded last night, you came up with the solution.


tryit editor
2023-05-01_16h27_20.jpg


tdl export through transform dialog
2023-05-01_16h40_03.jpg
This is the basis of estimating based on unit costs , on this example many docs can be produced.

@abstr when i was setting up the custom attributes I came up with a need to have lists with associated attributes.
for example the address of living of a person who works on a task, or it's phone number, or it's working rate per hour etc.
I was thinking of a spreadsheet type input, where the 1st column is the main attribute and the rest of the columns are the associated attributes.
In the main interface the user will only select the main attribute from a drop down list attribute field, but if there are any associated attributes they will be saved in the tdl file per task. This way even more project documentation can be produced from the resulting xml. For example resource management information and documentation.

User avatar
zonfeld
Posts: 173
Joined: Sun Mar 21, 2021 11:41 am
Contact:

Re: how to access Custom Attributes

Post by zonfeld » Mon May 01, 2023 2:24 pm

ispyridis wrote:
Mon May 01, 2023 2:16 pm
@zonfeld you really nailed it !!!
Happy to help! :)

User avatar
abstr
Site Admin
Posts: 368
Joined: Sun Jul 28, 2019 12:22 pm

Re: how to access Custom Attributes

Post by abstr » Tue May 02, 2023 12:04 am

@zonfeld

Are your examples sufficiently polished to add one (or all) of them to the ToDoList_Resources repo?

User avatar
abstr
Site Admin
Posts: 368
Joined: Sun Jul 28, 2019 12:22 pm

Re: how to access Custom Attributes

Post by abstr » Tue May 02, 2023 12:18 am

ispyridis wrote:
Mon May 01, 2023 2:16 pm
when i was setting up the custom attributes I came up with a need to have lists with associated attributes.
You'll have to suggest how that might look in the UI. Sounds very complicated. Can't you achieve the same outcome using multiple custom attributes?

User avatar
zonfeld
Posts: 173
Joined: Sun Mar 21, 2021 11:41 am
Contact:

Re: how to access Custom Attributes

Post by zonfeld » Tue May 02, 2023 1:22 pm

abstr wrote:
Tue May 02, 2023 12:04 am
Are your examples sufficiently polished to add one (or all) of them to the ToDoList_Resources repo?
"Polished" is a word I rarely use. I'm happy to get to "acceptable". ;)

I did some tweaking, added a description, changed the file extension and I think it's good enough to illustrate the principle without the front falling off immediately. Here's the current state of affairs, digestible by ToDoList (see the screenshot for the result), which means that no features of XSLT 2.0 are used.

I wouldn't add any other examples. I believe that would make it harder for people unfamiliar with XSLT to determine what's what. Those who are aware of a difference between XSLT 1.0 and 2.0 probably know what to do already, in all likelihood better than I. :-D

I'll let you be the judge of whether the example is worthy of appearing in the repo – and how you'd like to put it there so that people are able to make the connection between the two files. One without the other isn't of much use.

Custom_attribute_example_2023-05-02.jpg

Note: I decided not to include the fix for Jaxe because it's not a very commonly used and apparently outdated tool and @ispyridis knows how to add the namespace, if necessary.
Attachments
Custom_attribute_example.tdl
(11.44 KiB) Downloaded 31 times
Custom_attribute_example.xsl
(3.45 KiB) Downloaded 33 times

ispyridis
Posts: 95
Joined: Fri Apr 07, 2023 7:05 pm

Re: how to access Custom Attributes

Post by ispyridis » Wed May 03, 2023 1:01 pm

abstr wrote:
Tue May 02, 2023 12:18 am
ispyridis wrote:
Mon May 01, 2023 2:16 pm
when i was setting up the custom attributes I came up with a need to have lists with associated attributes.
You'll have to suggest how that might look in the UI. Sounds very complicated. Can't you achieve the same outcome using multiple custom attributes?
I will try to give example:
Person:
| name | rate | unit | quantity_in_task* |cost_in_task|address|age |telephone|email|date_started_work|marriage_status|etc|
| text | num |text | var | calc | text |num| text | text | date | text |

Equipment:
|name|rate|unit|quantity_in_task*|cost_in_task|location|ser.num./lic plates|power|powered_by|etc|
materials:
|name|rate|unit|quantity_in_task*|cost_in_task|dealer|dealer_address|dealer_phone|dealer_email|unit_weight|handling_info|etc|

Under the person row I give example of the types of data.


Custom attribute Definition pane:
This type of attribute will be named "fixed list with associative data"?
A spreadsheet type window.
A plus button to add columns
The column names will be the attribute's names
The rows will only take a number on the left side
At the top cell of the column name, a drop down button after the name at the right side of the cell, reveals the types of data that the columns accept, and the user can select the type.
The clac type reveals a formula field. Commands like sum, +, -, /, *, concatenate, right, left like the ones used in excel can be used.
Next to the column names and the drop down button, a checkbox will allow or not to see the attribute column in the UI pop up selector* (see below in UI suggestions).

Main UI attribute definition.
When we select attributes we see the list and we click on the side like it is done now with the check boxes.
The var types are values related to the attribute but specific to the task. Must be given at task definition on attribute selection , with pop up like the date selector but showing the list. (must be defined in attribute definition pane as variable (a value not defined in the list, but on the UI specific to the task)).

We gave an example of unit cost estimating using the existing attributes.

We could break this cost in three subcosts Total_Labor_Cost, Total_Equipment_cost and Total_Material_Cost, But we cannot do the calc(adding three attributes). Of course we can do it with the xslt if we know the values.
This is an intermediate way of depicting costs be tween unit cost estimating and analytic cost estimating and resource management.

If we implement the suggestion above we can use the rates of each item used with certain quantities implemented in the recipe of the task.
this way you will feed real item costs and quantitites. the Total_Labor_Cost, Total_Equipment_Cost and Total Material cost will be calculated from the sum of tthe costs he basic quantities. And finally the total task cost will be calculated by the sum of the three.

from this system you see you can produce additional documentation (even phone books related to the people engaged to show you another view)

You can make a document about when a material will be used and in what quantity etc.
It is like giving ERP capabilities to your system.

Maybe some one wants to add something on this if the idea is liked.

ispyridis
Posts: 95
Joined: Fri Apr 07, 2023 7:05 pm

Re: how to access Custom Attributes

Post by ispyridis » Wed May 03, 2023 1:07 pm

zonfeld wrote:
Tue May 02, 2023 1:22 pm
abstr wrote:
Tue May 02, 2023 12:04 am
Are your examples sufficiently polished to add one (or all) of them to the ToDoList_Resources repo?
"Polished" is a word I rarely use. I'm happy to get to "acceptable". ;)

I did some tweaking, added a description, changed the file extension and I think it's good enough to illustrate the principle without the front falling off immediately. Here's the current state of affairs, digestible by ToDoList (see the screenshot for the result), which means that no features of XSLT 2.0 are used.

I wouldn't add any other examples. I believe that would make it harder for people unfamiliar with XSLT to determine what's what. Those who are aware of a difference between XSLT 1.0 and 2.0 probably know what to do already, in all likelihood better than I. :-D

I'll let you be the judge of whether the example is worthy of appearing in the repo – and how you'd like to put it there so that people are able to make the connection between the two files. One without the other isn't of much use.


Custom_attribute_example_2023-05-02.jpg


Note: I decided not to include the fix for Jaxe because it's not a very commonly used and apparently outdated tool and @ispyridis knows how to add the namespace, if necessary.
Guys you are really fast I really can't follow on this tempo. :)

If @zonfeld or @abstr want to implement more xsl to the depository and the installation I could make some suggestions and try to help and learn from you but the problem is that you act faster than the speed of my thoughts. I will try to digest what you did by now and come with suggestions we can work together.

Post Reply