سؤال

I'm trying to bind xml to a form input as the value using xslt.

this is a snippet of my code (xsl):

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="/">

    <input name="Supervisor" id="Supervisor" binding="my:myFields/my:Supervisor" ftXPath="my:myFields/my:Supervisor">
       <xsl:value-of select="my:myFields/my:Supervisor"/>
    </input>

</xsl:template>
</xsl:stylesheet>

and my xml file

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<my:myFields xmlns:my="http://www.w3.org/TR/html4/">

 <my:Supervisor>Jane Doe</my:Supervisor>
</my:myFields>

I tried that but I cant seem to get the value to be in the input.

هل كانت مفيدة؟

المحلول

If you want to populate an HTML input control then you need to set its value attribute:

<input value="{my:myFields/my:mySupervisor}" .../>

Make sure the stylesheet declares the same namespace for the prefix my like the input XML.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top