Menu
News
All News
Dungeons & Dragons
Level Up: Advanced 5th Edition
Pathfinder
Starfinder
Warhammer
2d20 System
Year Zero Engine
Industry News
Reviews
Dragon Reflections
White Dwarf Reflections
Columns
Weekly Digests
Weekly News Digest
Freebies, Sales & Bundles
RPG Print News
RPG Crowdfunding News
Game Content
ENterplanetary DimENsions
Mythological Figures
Opinion
Worlds of Design
Peregrine's Nest
RPG Evolution
Other Columns
From the Freelancing Frontline
Monster ENcyclopedia
WotC/TSR Alumni Look Back
4 Hours w/RSD (Ryan Dancey)
The Road to 3E (Jonathan Tweet)
Greenwood's Realms (Ed Greenwood)
Drawmij's TSR (Jim Ward)
Community
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions, OSR, & D&D Variants
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Resources
Wiki
Pages
Latest activity
Media
New media
New comments
Search media
Downloads
Latest reviews
Search resources
EN Publishing
Store
EN5ider
Adventures in ZEITGEIST
Awfully Cheerful Engine
What's OLD is NEW
Judge Dredd & The Worlds Of 2000AD
War of the Burning Sky
Level Up: Advanced 5E
Events & Releases
Upcoming Events
Private Events
Featured Events
Socials!
EN Publishing
Twitter
BlueSky
Facebook
Instagram
EN World
BlueSky
YouTube
Facebook
Twitter
Twitch
Podcast
Features
Top 5 RPGs Compiled Charts 2004-Present
Adventure Game Industry Market Research Summary (RPGs) V1.0
Ryan Dancey: Acquiring TSR
Q&A With Gary Gygax
D&D Rules FAQs
TSR, WotC, & Paizo: A Comparative History
D&D Pronunciation Guide
Million Dollar TTRPG Kickstarters
Tabletop RPG Podcast Hall of Fame
Eric Noah's Unofficial D&D 3rd Edition News
D&D in the Mainstream
D&D & RPG History
About Morrus
Log in
Register
What's new
Search
Search
Search titles only
By:
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions, OSR, & D&D Variants
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Menu
Log in
Register
Install the app
Install
Upgrade your account to a Community Supporter account and remove most of the site ads.
Community
General Tabletop Discussion
*Geek Talk & Media
Open Source d20 API/Engine
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="reanjr" data-source="post: 2147831" data-attributes="member: 20740"><p>As to the first point, there is a way to do it (and I suppose it could be mashed into a function, too; but I hadn't gotten to anything like that yet). Basically, the <a> function can resolve simple XPath like statements and return arrays of data. For instance:</p><p></p><p><a>feats.feat:type='Fighter'</a></p><p></p><p>Would return an array of all feat elements that are children of the feats element and half a type attribute set to Fighter. Once you have this array, you can use another special resolution mechanism ::</p><p></p><p>Say that you store the array in a variable called fighter-feats. Then:</p><p></p><p><a>fighter-feats::count</a></p><p>Would return the number of elements in the array</p><p></p><p><a>fighter-feats::1</a></p><p>Would return the first of them.</p><p></p><p>So you could fairly easily write a foreach function (and I'm pretty sure I will).</p><p></p><p>I haven't finalized anything on the way those variable resolutions work yet, but tentatively, the following apply:</p><p></p><p>[CODE]</p><p>.</p><p>Current context</p><p></p><p>.child</p><p>The child of the current context (and so forth like .child.grandchild etc.) This can be a child element or a property of the context.</p><p></p><p>:property</p><p>A property. If this is left without any qualification, it just checks if the property exists or not. You can also append ='value' to evaluate to a property that is set to a particular value. I use single quotes here for ease of parsing. Unlike using the .child syntax to select a property, using the :property syntax doesn't evaluate to the property but is used as a means of identifying elements. (I hope I explained that clearly, I can't tell).</p><p></p><p>::count</p><p>The number of elements in the reference. Usually 1.</p><p></p><p>::1, ::2, etc.</p><p>A particular element if there are multiple. Defaults to the first element if unspecified.</p><p></p><p>[ ]</p><p>Anything found in brackets is evaluated as a variable reference then plugged in to its surroundings (<a>fighter-feats::[counter]</a> for instance).</p><p></p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="reanjr, post: 2147831, member: 20740"] As to the first point, there is a way to do it (and I suppose it could be mashed into a function, too; but I hadn't gotten to anything like that yet). Basically, the <a> function can resolve simple XPath like statements and return arrays of data. For instance: <a>feats.feat:type='Fighter'</a> Would return an array of all feat elements that are children of the feats element and half a type attribute set to Fighter. Once you have this array, you can use another special resolution mechanism :: Say that you store the array in a variable called fighter-feats. Then: <a>fighter-feats::count</a> Would return the number of elements in the array <a>fighter-feats::1</a> Would return the first of them. So you could fairly easily write a foreach function (and I'm pretty sure I will). I haven't finalized anything on the way those variable resolutions work yet, but tentatively, the following apply: [CODE] . Current context .child The child of the current context (and so forth like .child.grandchild etc.) This can be a child element or a property of the context. :property A property. If this is left without any qualification, it just checks if the property exists or not. You can also append ='value' to evaluate to a property that is set to a particular value. I use single quotes here for ease of parsing. Unlike using the .child syntax to select a property, using the :property syntax doesn't evaluate to the property but is used as a means of identifying elements. (I hope I explained that clearly, I can't tell). ::count The number of elements in the reference. Usually 1. ::1, ::2, etc. A particular element if there are multiple. Defaults to the first element if unspecified. [ ] Anything found in brackets is evaluated as a variable reference then plugged in to its surroundings (<a>fighter-feats::[counter]</a> for instance). [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*Geek Talk & Media
Open Source d20 API/Engine
Top