Follow

can’t believe this is the easiest way to resolve a QName in XSLT 1.0 

<variable name="dcmitype">
<for-each select="rdf:type/@rdf:resource">
<variable name="datatypeelt">
<element name="{.}"/>
</variable>
<if test="namespace-uri(exsl:node-set($datatypeelt)//*[1])='purl.org/dc/dcmitype/'">
<value-of select="local-name(exsl:node-set($datatypeelt)//*[1])"/>
<text>,</text>
</if>
</for-each>
</variable>
<choose>
<when test="contains($dcmitype, ',')">
<value-of select="substring-before($dcmitype, ',')"/>
</when>
<otherwise>
<text>???</text>
</otherwise>
</choose>

· · Web · 1 · 0 · 0

can’t believe this is the easiest way to resolve a QName in XSLT 1.0 

re: can’t believe this is the easiest way to resolve a QName in XSLT 1.0 

@jdp23 they fixed a lot of this stuff in later versions (i know that XPath 3 has a function for this for example), but browsers never implemented anything beyond the first version (and would love to get rid of that too, but can’t because too much enterprise software depends on it)

honestly i’m just glad (and kind of surprised) there’s any way to do it at all

re: can’t believe this is the easiest way to resolve a QName in XSLT 1.0 

@Lady@glitch.cat.family back in the day I had an intern who wound up doing a primarily project in XSLT. It came out great, she demo'ed it to very senior people who were extremely impressed, she got great recommendations etc etc ... but at the end of the summer when we talked about what she had learned, "avoid XSLT if you possibly can" was very high on her list.

re: can’t believe this is the easiest way to resolve a QName in XSLT 1.0 

@jdp23 i really like it conceptually and it has a lot of applicability for the kinds of things i do, but your tolerance for things just being unnecessarily complex sometimes has to be really high if you ever want to get anything interesting done

re: can’t believe this is the easiest way to resolve a QName in XSLT 1.0 

@Lady@glitch.cat.family 💯. When I first learned about it I thought "how elegant!" But the reality is ... less elegant.

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.