|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] xpath predicate help
I am transforming SGML to XML. The sample sgml is: <graphic id="123" name="graphic" ......> <grphprim id="456" ....> </graphic> . . . <link linkends="999 456">link text</link> What I am trying to do is. When I find a link to a <grphprim element in sgml I want the xml link I create to link to the parent <graphic. The linkends attribute needs to be manipulated to get the part after the space. The xml I am using that does not work <xsl:element name="link"> <xsl:attribute name="linkend"> <xsl:variable name="link-target" <xsl:value-of select="substring-after(./@linkends,' ')"/> </xsl:variable> <xsl:choose> <xsl:when test="name(//*[@id=$link-target])='grphprim'"> <xsl:variable name="parent_graphic" select="//graphic[grphprim/@id=$link-target]"/> <xsl:value-of select="$parent_graphic/@id"> </xsl:when> <xsl:otherwise> <xsl:value-of select="$link-target"/> </xsl:othewise> </xsl:choose> </xsl:attribute> </xsl:element> This however does work. If I hard-code the id in below it works, If I use a variable as in above it does not work. Any help would be appreciated. <xsl:element name="link"> <xsl:attribute name="linkend"> <xsl:variable name="link-target" <xsl:value-of select="substring-after(./@linkends,' ')"/> </xsl:variable> <xsl:choose> <xsl:when test="name(//*[@id=$link-target])='grphprim'"> <xsl:variable name="parent_graphic" select="//graphic[grphprim/@id='456']"/> <xsl:value-of select="$parent_graphic/@id"> </xsl:when> <xsl:otherwise> <xsl:value-of select="$link-target"/> </xsl:othewise> </xsl:choose> </xsl:attribute> </xsl:element>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








