Hey, I'm Developer Jesse Senior developer and technical lead at Rootstock Labs.

I build applications on Bitcoin via Rootstock EVM compatible blockchain. Projects include DAOs, wallets, account abstraction, digital identity and crypto domains.

Blog Posts Page: 7 of 7

  • Pull in Files using XSL and Tag Management in OU Campus

    The Library website at the University of Northern Colorado has a list of academic journals that they subscribe to. This list is constantly changing and needs to be updated by Library staff. The academic journals are organized in an A-Z listing as well as organized by subject. Each journal can belong to a single subject or multiple subjects.

    If this was a SQL database there would be three tables. One table for the journals, a table for subjects and a table linking between the subjects and the journals.

    With OU Campus ‘tags’ can be added to the page to create the link between journals and subjects. On each subject page, the journals with that individual tag get pulled in.

    “Data Files”

    List of Datafiles

    Data files are standalone .pcf files that are similar to a database entry. Each file contains the information for a single journal entry: Journal Name, Description, URL and a dropdown for Active, which will tell the XSL if the data file should be pulled in or not. Line 9 defines the page type as library-database which will be used in case other OU users assign tags to their pages.

    Data File XSL

    In the XSL for the Data File, the tags that are associated with the page are looped and displayed:

    GetTags() returns a node with the sibling node of . Display the tag name: ``

    The next step (will take some time but only has to be done once,) is to create a data file for every Library Academic Journal.

    Subject Tags

    The data files will be pulled in based on the tags that are associated with that data file. Each data file can have an unlimited number of tags associated with it allowing it to belong to an unlimited number of subject areas. A tag needs to be created for each subject area. This may also take some time, and could be been done when the DataFile is being created. A naming convention would be a good idea. For this demo library-database-name. is used.

    Assigning a Tag to a Data File

    Tags are stored on OU Campus and not with the individual .pcf file, so if you have cloned the repo you will need to add tags to each data file. It would also be a good idea to duplicate the data file to have more than one page to pull in.

    Subject Pages

    Now that the data files have been created and assigned tags, they need to be pulled into the subject pages. The tag that will be pulled in will be the first tag associated with the subject page. For the demo, the subject page will pull in Accounting Journals. Attach the library-database-accounting tag to this subject page.

    Assign the tag to the Subject Page

    Below is the XSL for the subject pages. On line 4 the first tag that is associated with the page is assigned to the variable $page-tag. Then all pages with that tag are are assigned to the variable $tag-select Finally, the data files are looped and the path of each data file is passed to a template to display the content:

    On line 16 of the previous code example, the data file’s path is passed to the function GetContentFromSingleDataFile. More code could be nested here, but breaking it up into multiple templates is easier to read and is better organization and re-usability of code.

    GetContentFromSingleDataFile

    This code snippet takes the path as a parameter (line 3) and creates a variable of the full path to the file (line 6). Next, the content of the page is stored as a new variable (line 9). Lines 6 and 9 could be combined into a single variable.

    Line 12 checks to see if the page-type is a library-database file. This is important since anyone can assign tags to a page in OU Campus. By selecting only pages with the page type of library-database no renegade pages will be pulled in.

    Checking to make sure the Active dropdown is set to True (line 15) will allow end users to turn on and off databases as access is changed.

    Finally, it the database name, description and link are outputted.

    Wrap Up

    The final step would be to create subject pages for each subject. UNC has about 50 academic journal subjects and a page will be created for each one as well as a master A-Z listing. If there is interest, I can write up an article about the listing page which won’t use the tags since every journal will get pulled in.

    This is my first technical post so feedback is welcomed. The full source code is on GitHub.

  • Preventing users from adding JavaScript with XSL

    Our Content Management System, OmniUpdate, allows users to create reusable pieces of content called assets. As of this post, there are five different types of assets and two of them and two of them allow the user to add source code: Web Content and Source Code.

  • The Unpublished Gadget

    At the 2016 OmniUpdate Hackathon I joined a group of six people who built a gadget that unpublishes files from the web server. The idea started out as a simple sidebar gadget that when clicked would go to the production server and remove the file while keeping it on the staging server. After about two hours of coding the gadget was “completed”. At that point, if you unpublished a file and navigated a different page, the button was still disabled. This was a known bug and I reported it the next day. Yesterday I had sometime to fix this error and I believe the gadget is ready to be used.

  • After about two hours of coding the gadget was “completed”. At that point, if you unpublished a file and navigated a different page, the button was still disabled. This was a known bug and I reported it the next day. Yesterday I had sometime to fix this error and I believe the gadget is ready to be used.

    -->