{"id":16102362,"url":"https://github.com/sshaw/xslt-timecode","last_synced_at":"2026-02-26T18:11:07.288Z","repository":{"id":136718476,"uuid":"66776889","full_name":"sshaw/xslt-timecode","owner":"sshaw","description":"A pure, dependency free, XSLT 1.0 library for video timecode manipulation","archived":false,"fork":false,"pushed_at":"2016-08-29T00:06:38.000Z","size":14,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-12T06:59:43.242Z","etag":null,"topics":["conversions","drop-frames","frame-rate","timecode","video-timecode-manipulation","xml","xslt"],"latest_commit_sha":null,"homepage":null,"language":"XSLT","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sshaw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-28T15:50:13.000Z","updated_at":"2025-02-07T09:28:28.000Z","dependencies_parsed_at":"2023-07-03T09:00:33.469Z","dependency_job_id":null,"html_url":"https://github.com/sshaw/xslt-timecode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshaw%2Fxslt-timecode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshaw%2Fxslt-timecode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshaw%2Fxslt-timecode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sshaw%2Fxslt-timecode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sshaw","download_url":"https://codeload.github.com/sshaw/xslt-timecode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419871,"owners_count":20936013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conversions","drop-frames","frame-rate","timecode","video-timecode-manipulation","xml","xslt"],"created_at":"2024-10-09T18:53:39.341Z","updated_at":"2026-02-26T18:11:02.244Z","avatar_url":"https://github.com/sshaw.png","language":"XSLT","readme":"Timecode\n=======\n\n[![Build Status](https://travis-ci.org/sshaw/xslt-timecode.svg)](https://travis-ci.org/sshaw/xslt-timecode)\n\nA pure, dependency free, XSLT 1.0 library for video timecode manipulation.\n\nSupports\n---------\n\n* Any frame rate\n* Drop/nondrop frame timecodes\n* Arithmetic\n* Conversions: to/from drop/nondrop, timecode to/from frames\n* Formatting\n* Field extraction\n\n\nUsage\n---------\n\nSetup the timecode namespace:\n\n\t\u003cxsl:stylesheet version=\"1.0\"\n\t  xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n      xmlns:tc=\"http://screenstaring.com/xslt/timecode\"\u003e\n\nImport (or include) the stylesheet:\n\n    \u003cxsl:import href=\"/path/to/timecode.xsl\"/\u003e\n\nExamples\n---------\n\n\t\u003c?xml version=\"1.0\"?\u003e\n\t\u003cxsl:stylesheet version=\"1.0\"\n\t  xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"\n      xmlns:tc=\"http://screenstaring.com/xslt/timecode\"\u003e\n\n      \u003cxsl:import href=\"timecode.xsl\"/\u003e\n\n\t  \u003c!-- Returns: 1800 --\u003e\n\t  \u003cxsl:variable name=\"frames\"\u003e\n\t      \u003cxsl:call-template name=\"tc:to-frames\"\u003e\n\t          \u003cxsl:with-param name=\"timecode\"\u003e00:00:01:02\u003c/xsl:with-param\u003e\n\t\t      \u003cxsl:with-param name=\"drop-frame\" select=\"true()\"/\u003e\n\t      \u003c/xsl:call-template\u003e\n\t  \u003c/xsl:variable\u003e\n\n\t  \u003c!-- No need to set $drop-frame if the timecode has a drop frame delimiter (\";\" or \".\") --\u003e\n      \u003c!-- Returns: 1800 --\u003e\n\t  \u003cxsl:variable name=\"frames\"\u003e\n\t      \u003cxsl:call-template name=\"tc:to-frames\"\u003e\n\t          \u003cxsl:with-param name=\"timecode\"\u003e00:00:01;02\u003c/xsl:with-param\u003e\n\t      \u003c/xsl:call-template\u003e\n\t  \u003c/xsl:variable\u003e\n\n\t  \u003c!-- Returns: 00:30:22:14 --\u003e\n\t  \u003cxsl:variable name=\"timecode\u003e\n\t      \u003cxsl:call-template name=\"tc:from-frames\"\u003e\n\t          \u003cxsl:with-param name=\"frames\"\u003e54674\u003c/xsl:with-param\u003e\n\t\t      \u003cxsl:with-param name=\"fps\"\u003e29.97\u003c/xsl:with-param\u003e\n\t      \u003c/xsl:call-template\u003e\n\t  \u003c/xsl:variable\u003e\n\n\t  \u003c!-- Returns: 02:00:00:00 --\u003e\n\t  \u003cxsl:variable name=\"sum\"\u003e\n\t      \u003cxsl:call-template name=\"tc:add\"\u003e\n\t          \u003cxsl:with-param name=\"timecode1\"\u003e01:59:59:29\u003c/xsl:with-param\u003e\n\t          \u003cxsl:with-param name=\"timecode2\"\u003e00:00:00:01\u003c/xsl:with-param\u003e\n\t      \u003c/xsl:call-template\u003e\n\t  \u003c/xsl:variable\u003e\n\n\t  \u003cxsl:variable name=\"product\"\u003e\n\t      \u003cxsl:call-template name=\"tc:multiply\u003e\n\t          \u003cxsl:with-param name=\"timecode\"\u003e00:10:59:02\u003c/xsl:with-param\u003e\n\t\t      \u003cxsl:with-param name=\"by\"\u003e2\u003c/xsl:with-param\u003e\n\t          \u003cxsl:with-param name=\"fps\"\u003e24\u003c/xsl:with-param\u003e\n\t\t  \u003c/xsl:call-template\u003e\n\t  \u003c/xsl:variable\u003e\n\n      \u003c!-- Extract the minutes --\u003e\n      \u003c!-- Returns: 10 --\u003e\n\t  \u003cxsl:variable name=\"minutes\u003e\n\t      \u003cxsl:call-template name=\"tc:minutes\"\u003e\n\t          \u003cxsl:with-param name=\"timecode\"\u003e00:10:21;22\u003c/xsl:with-param\u003e\n\t      \u003c/xsl:call-template\u003e\n\t  \u003c/xsl:variable\u003e\n\nKnown Issues\n---------\n\n* Under Saxon, `to-frames` returns a value in scientific notation\n\nTemplates\n---------\n\n* [Overview](#overview)\n* [Arithmetic](#arithmetic)\n* [Conversion](#conversion)\n* [Parsing \u0026 Formatting](#parsingformatting)\n* [Validation](#validation)\n\n### Overview\n\n#### Frames Per Second (FPS)\n\nUnless specified when calling a template frames per second defaults to `29.97`. This can be changed\nglobally by setting `default-fps`.\n\n#### Drop Frame\n\nAll drop frame arguments default to `false()`. If the drop frame parameter is not set and the timecode's frame delimiter\nis `\".\"` or `\";\"` the timecode will be treated as drop frame.\n\n### Arithmetic\n\nTemplates return `\"NaN\"` on error. This is a string and should not be confused with the XPath numeric type of `NaN`.\nOn success the resulting timecode is returned.\n\n#### `add`\n\n##### Parameters\n\n* `timecode1` - Left operand, **required**\n* `fps1` - `timecode1`'s frames per second\n* `drop-frame1` - Set to `true()` if `timecode1` is drop frame\n* `timecode2` - Right operand, **required**\n* `fps2` - `timecode2`'s frames per second\n* `drop-frame2` - Set to `true()` if `timecode2` is drop frame\n\n#### `divide`\n\n##### Parameters\n\n* `timecode` - Numerator, **required**\n* `by` - Denominator, **required**. This is a numeric value, not a timecode\n* `fps` - Frames per second of `timecode`\n\n#### `multiply`\n\n##### Parameters\n\n* `timecode` - A timecode to multiply, **required**\n* `by` - Value to multiply timecode by, **required**. This is a numeric value, not a timecode\n* `fps` - Frames per second of `timecode`\n* `drop-frame` - `true()` if `timecode` is drop frame, defaults to `false()`\n\n#### `subtract`\n\n##### Parameters\n\n* `timecode1` - Left operand, **required**\n* `fps1` - `timecode1`'s frames per second\n* `drop-frame1` - Set to `true()` if `timecode1` is drop frame\n* `timecode2` - Right operand, **required**\n* `fps2` - `timecode2`'s frames per second\n* `drop-frame2` - Set to `true()` if `timecode2` is drop frame\n\n### Conversion\n\n#### `convert`\n\nConvert a timecode's frame rate, format, or to/from drop frame.\n\n* `timecode` - Timecode to convert, **required**\n* `fps` - `timecode`'s frames per second\n* `drop-frame` - Set to `true()` if `timecode` is drop frame\n* `to-fps` - Frames per second to convert `timecode` to\n* `to-drop-frame` - Convert `timecode` to drop frame\n* `delimiter` - String use to delimit the hours, minutes, and seconds in the resulting timecode, defaults to `\":\"`\n* `frame-delimiter` - String use to delimit frames in the resulting timecode, defaults to `\":\"`\n\n#### `to-frames`\n\nConverts the given timecode to frames.\n\n##### Parameters\n\n* `timecode` - Timecode to convert, **required**\n* `fps` - `timecode`'s frames per second\n* `drop-frame` - Set to `true()` if `timecode` is a drop frame\n\n##### Returns\n\nOn success the frame representation of the `timecode`. On error an empty string.\n\n### Parsing/Formatting\n\n#### `hours`\n\nExtract the hours part from the given timecode.\n\n##### Parmeters\n\n* `timecode` - Timecode to extract hours from, **required**\n\n##### Returns\n\nOn success the hour part of `timecode`. On error an empty string.\n\n#### `minutes`\n\nExtract the minutes part from the given timecode.\n\n##### Parameters\n\n* `timecode` - Timecode to extract minutes from, **required**\n\n##### Returns\n\nOn success the minute part of `timecode`. On error an empty string.\n\n#### `seconds`\n\nExtract the seconds part from the given timecode.\n\n##### Parameters\n\n* `timecode` - Timecode to extract seconds from, **required**\n\n##### Returns\n\nOn success the second part of `timecode`. On error an empty string.\n\n#### `frames`\n\nExtract the frames part from the given timecode.\n\n##### Parameters\n\n* `timecode` - Timecode to extract frames from, **required**\n\n##### Returns\n\nOn success the frame part of `timecode`. On error an empty string.\n\n#### `from-frames`\n\nCreate a timecode from the given number of frames.\n\n##### Parameters\n\n* `frames` - Frames to create a timecode from, **required**\n* `fps` - `frames` frames per second\n* `drop-frame` - Set to `true()` if `frames` are drop frames\n* `delimiter` - String use to delimit the hours, minutes, and seconds in the resulting timecode, defaults to `\":\"`\n* `frame-delimiter` - String use to delimit frames in the resulting timecode, defaults to `\":\"`\n\n##### Returns\n\nOn success a timecode. On error an empty string.\n\n### Validation\n\n#### `valid`\n\nCheck if the given timecode is valid\n\n##### Parameters\n\n* `timecode` - Timecode to validate, **required**\n\n##### Returns\n\n`\"true\"` if `timecode` is valid, `\"false\"` otherwise.\nNote that this is a string and not an XPath boolean as returned by `true()` or `false()`.\n\nAbout\n---------\n\nThis library is a port of the Perl [`Time::Timecode`](https://github.com/sshaw/Time-Timecode) module,\nthough it does not (yet) implement all of `Time::Timecode`'s functionality.\n\nAuthor\n---------\n\nSkye Shaw (skye.shaw [AT] gmail)\n\n\nLicense\n---------\n\n    Copyright (C) 2011-2016 Skye Shaw\n\n    Released under the MIT License: www.opensource.org/licenses/MIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshaw%2Fxslt-timecode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsshaw%2Fxslt-timecode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsshaw%2Fxslt-timecode/lists"}