[Bug 18973] New: We need a way to write XPath expressions within elements

https://www.w3.org/Bugs/Public/show_bug.cgi?id=18973

           Summary: We need a way to write XPath expressions within
                    elements
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 3.0
        AssignedTo: mike@saxonica.com
        ReportedBy: vdv@dyomedea.com
         QAContact: public-qt-comments@w3.org


XPath is becoming more powerful with each new version and as syntax is getting
more complex attributes become less and less adequate to write complex XPath
expressions:

 * it is not possible to use CDATA sections to avoid escaping common characters
such as "<".
 * many tools do not preserve white spaces (and indentation) within attributes.
 * XML comments cannot be embedded in attributes.

Being able to write XPath expressions within elements content would then be
really handy for complex XPath expressions.

I can think of two options to achieve this.

The first one would be to generalize AVTs so that XPath expressions can be
embedded within text nodes using curly brackets. Florent Georges mentioned
something along these lines yesterday at the XML Summer School but I don't find
the feature in the latest working draft and it seemed to be restricted to a
very specific kind of usage anyway. 

The second option would be to define and xsl:select element that could be use
anywhere where @select attributes are allowed in a transformation and would
have exactly the same meaning and content (any @select attribute could be
replaced by an xsl:select element with the exact same content and any
xsl:select element could be replaced by a @select attribute (after having
removed comments and PIs)):

<xsl:variable select="... long XPath expression..."/>

would be equivalent to

<xsl:variable>
  <xsl:select>... long XPath expression...</xsl:select>
</xsl:variable>

Being only syntactic sugar, this should be a rather minor modification but it
would make our life much easier!

Would that make sense?

Thanks,

Eric

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Saturday, 22 September 2012 12:32:22 UTC