How do you add an image?

后端 未结 5 1513
死守一世寂寞
死守一世寂寞 2021-02-07 06:46

Situation:

I have a simple XML document that contains image information. I need to transform it into HTML. However, I can\'t see where

5条回答
  •  时光取名叫无心
    2021-02-07 07:31

    Just to clarify the problem here - the error is in the following bit of code:

    
        
    
    

    The instruction xsl:copy-of takes a node or node-set and makes a copy of it - outputting a node or node-set. However an attribute cannot contain a node, only a textual value, so xsl:value-of would be a possible solution (as this returns the textual value of a node or nodeset).

    A MUCH shorter solution (and perhaps more elegant) would be the following:

    
    

    The use of the {} in the attribute is called an Attribute Value Template, and can contain any XPATH expression.

    Note, the same XPath can be used here as you have used in the xsl_copy-of as it knows to take the textual value when used in a Attribute Value Template.

提交回复
热议问题