In some...">

Xsl strange behavior using variables

I saved the file tree in $ to

<xsl:variable name="onto" select="document('file.xml')"/>

      

In some places, I can use this variable pending:

<xsl:copy-of select="$onto/rdf:RDF"/>

      

But I'm having problems elsewhere, strange characters are written in the output:

<xsl:element name="autor">
     <xsl:attribute name="rdf:resource">

     <xsl:text>#</xsl:text> <xsl:value-of select="$onto"/>
     </xsl:attribute>
</xsl:element>

      

This is the start of the input I have:

<autor rdf:resource="#&#10;  &#10;  &#10;    &#10;      &#10;    &#10;  &#10;  &#10;    &#10;      &#10;    &#10;  &#10;  &#10;    &#10;      &#10;    &#10;  &#10;  &#10;  &#10;    &#10;  &#10;  &#10;    &#10;      &#10;    &#10;  &#10; 

      

What am I missing? What's wrong? If this is a lot for an attribute, what can I do? thank you

0


a source to share


1 answer


When <xsl:value-of>

applied to a slice of a tree, it accepts the textual content of that tree. In your case, it looks like your XML file contains no text (other than whitespace) that has no attribute value. I suspect that you want to select the value of a specific node attribute in the document, for example:

<xsl:value-of select="$onto//foo/@bar"/>

      



(Without knowing the structure of your XML and what you are trying to choose, I have no idea what the real path will be.)

0


a source







All Articles