XSLT (1.0): comparing substring-after to attribute value fails -


maybe have overlooked obvious, @ moment i'm @ loss. trying node comparing attribute @id result of call substring-before. while fails, manually entering string gives right result , puzzled problem is. there no whitespaces interfering , result of substring-before() want.

i have following snippet in file mets.xml:

<mets:file id="edoc_ed000227_fg_kuttenberger_religionsfriede" mimetype="text/xml">     <mets:flocat loctype="url" xlink:href="quellentexte/kuttenberger_religionsfriede.xml"/> </mets:file> 

the file apply transformation has basic outline:

<tei xmlns="http://www.tei-c.org/ns/1.0"      xml:id="edoc_ed000227_fg_kuttenberger_religionsfriede_dt">     [...]     <p xml:id="p001">[...]</p> </tei> 

i apply following transformation:

<xsl:template match="tei:p[@xml:id]">     <xsl:variable name="test" select="substring-before(/tei:tei/@xml:id, '_dt')"/>     <xsl:variable name="target" select="document($metsfile)//mets:file[@id=substring-before(/tei:tei/@xml:id, '_dt')]/mets:flocat/@xlink:href"/>     <xsl:variable name="target2" select="document($metsfile)//mets:file[@id='edoc_ed000227_fg_kuttenberger_religionsfriede']/mets:flocat/@xlink:href"/>     [<xsl:value-of select="$test"/>]     [<xsl:value-of select="$target"/>]     [<xsl:value-of select="$target2"/>] </xsl:template> 

and get

    [edoc_ed000227_fg_kuttenberger_religionsfriede]     []     [quellentexte/kuttenberger_religionsfriede.xml] 

so, substring-before() correctly returns edoc_ed000227_fg_kuttenberger_religionsfriede yet using function call retrieve target value fails though node correctly found when using string literally.

thanks or hints!

the problem expression use in substring-before, target variable in context of "mets" file. say, tei:tei in mets file, not in current document.

as have stored substring-before value in variable; "test", can use in expression instead.

<xsl:variable name="target" select="document($metsfile)//mets:file[@id=$test]/mets:flocat/@xlink:href"/> 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -