none
extract text from xml node using xslt

Antworten

  • Hi,

    It can't work on "script" since your templates only match "field", "var" or "if". You would have to add "script" as well.

    The xsl:value-of select="@name" extracts the value of an attribute called name on the current element (in this case the var element). Nothing more or less. Your jscript stuff is a text node. So to access that you would need to do something along the lines os xsl:value-of select="script". But that would still get you the entire jscript function. To get just parts of it, you need to understand which parts you want. Inside XSLT there's only a limited support for manipulating strings. It can do simple stuff like substring and length and such. That will probably not be enough for you to extract just the parts of the string you want. Not counting that I still think that you would need to understand the jscript to do this correctly.

    Thanks,


    Vitek Karas [MSFT]
    • Als Antwort markiert amirin Donnerstag, 21. Oktober 2010 05:47
    Donnerstag, 24. Juni 2010 07:46

Alle Antworten

  • Hi,

    Extracting the entire jscript blocks from the XML is not that hard, but finding the method calls in the jscript is. To do that reliably you would need a jscript parser which is definitely not part of any XSLT engine. If you are willing to write code to do that, you can use extensions to XSLT. But that depends on the engine you're going to use to run your XSLT. The way to plugin custom code differs between .NET, MSXML, other engines.

    Thanks,


    Vitek Karas [MSFT]
    Dienstag, 15. Juni 2010 07:47
  • Hi,

    It can't work on "script" since your templates only match "field", "var" or "if". You would have to add "script" as well.

    The xsl:value-of select="@name" extracts the value of an attribute called name on the current element (in this case the var element). Nothing more or less. Your jscript stuff is a text node. So to access that you would need to do something along the lines os xsl:value-of select="script". But that would still get you the entire jscript function. To get just parts of it, you need to understand which parts you want. Inside XSLT there's only a limited support for manipulating strings. It can do simple stuff like substring and length and such. That will probably not be enough for you to extract just the parts of the string you want. Not counting that I still think that you would need to understand the jscript to do this correctly.

    Thanks,


    Vitek Karas [MSFT]
    • Als Antwort markiert amirin Donnerstag, 21. Oktober 2010 05:47
    Donnerstag, 24. Juni 2010 07:46